While working on one of our projects my colleague Sebastian had to create a pdf with some text and charts. In a new post on his blog he explains how he leveraged headless Chrome to create the pdf.
Headless Chrome to the rescue! Chrome can run as a cli tool, and print a pdf file from a url. Al I had to do was make some layout tweaks to make everything printer-friendly.
Meanwhile support for creating pdfs has been added to our Browsershot package (which also uses headless Chrome under the hood).
Here’s how you can convert a webpage to a pdf using the package: