I relaunch this old post.
For whom is still searching an alternative to wkhtmlToPdf or wkhtmlToImage that working with the lastest features of CSS3 and HTML5, here I found two tools thanks to this github issues :
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4092
So there is two awesome tools that simply use the Chromium browser directly, the one I use is Pupputer that allow you to use it though Node.js code (so it's a good thing for Node.js web server 😮 !), taking a screenshot of the webpage and convert it to pdf or image.
Also it allow you to choose your chromium based browser 🥳!!! (Use puppeteer-core instead of puppeteer for the light version and using an external chromium)
I try it and it just render a screenshot that is the same as you can see it on your chromium browser, I use the rotateX, rotateY, rotateZ
with perspective
of CSS properties and working very well.
Enjoy !!!
Puppeteer : https://github.com/puppeteer/puppeteer
ChromeHtmlToPdf : https://github.com/Sicos1977/ChromeHtmlToPdf
Below a simple code to try it in your local side with Node.js :
// I use here the light version so I can choose my default chromium browser that I used on my Windows
// to install it :
// npm -i puppeteer-core
const puppeteer = require('puppeteer-core');
(async ()=>{
// path to my default browser, idk if it's work with opera or other chromium based browser
const browser = await puppeteer.launch({ executablePath: 'E:/Programmes/chrome-win/chrome.exe' });
const page = await browser.newPage();
// the default size if 800 * 600
await page.setViewport({
width: 800,
height: 533,
deviceScaleFactor: 1,
});
// the page targeted that I want the screenshot
await page.goto('http://localhost/Fiverr/3dAxis/temp/2_photo2.jpg.html');
// the output
await page.screenshot({ path: 'example.png' });
await browser.close();
})();