Angga Ardinata
07/29/2024, 12:44 AMFrank Bouwens
07/29/2024, 8:45 AMFrank Bouwens
07/29/2024, 8:45 AMFrank Bouwens
07/29/2024, 8:46 AMwkhtmltopdf
does this trick headless, and can be done on the server-side. Just feed it HTML, and it will generate a PDF, using the “print-to-pdf” function, as present in WebKit.Frank Bouwens
07/29/2024, 8:50 AMwkhtmltopdf
is uses an old version of WebKit, and may not support all of the latest and greatest CSS3, SVG, JavaScript features.
A solution to this, would be to use an up-to-date version of Chrome;
And control it somehow. That’s where puppeteer
comes in:
https://github.com/puppeteer/puppeteer
It can fully control the Chrome browser, and therefor also use the print-to-pdf function.
Here’s a PHP library that does exactly that:
https://github.com/spiritix/php-chrome-html2pdfSkaldebane
07/29/2024, 4:51 PMSkaldebane
07/29/2024, 4:53 PMSkaldebane
07/29/2024, 4:56 PM@Composable
in Compose/Web, I have no clue at all. It would be great if there's a headless way to do so (without needing to add any HTML elements to the DOM / modifying the actual UI of the app), but I'm not sure.ImageComposeScene
which allows rendering a Composable out into an image (which can then be encoded as any of the well-known images types (.png
/`.jpeg`)). This works well in headless mode so it can be run on a server!SingleLayerComposeScene
(code linked above), then pass it to a JS PDF library.Skaldebane
07/29/2024, 4:58 PMAngga Ardinata
07/29/2024, 10:50 PMSkaldebane
07/29/2024, 10:59 PMSkaldebane
07/29/2024, 11:00 PMAngga Ardinata
07/30/2024, 3:38 AMAngga Ardinata
07/30/2024, 3:39 AMSkaldebane
07/30/2024, 7:30 AMAngga Ardinata
07/30/2024, 7:31 AMAngga Ardinata
07/30/2024, 7:31 AMAngga Ardinata
07/30/2024, 7:35 AMSkaldebane
07/30/2024, 7:38 AMAngga Ardinata
07/30/2024, 7:41 AMSkaldebane
07/30/2024, 12:24 PMSkaldebane
07/30/2024, 12:25 PMAngga Ardinata
07/30/2024, 12:42 PMChrimaeon
07/30/2024, 2:03 PMsourcemaps
.
https://webpack.js.org/configuration/devtool/
You should be able to configure this via the Gradle plugin or webpack.config.d