Open westy92 opened 7 years ago
Thanks. Sadly chromium isn't as far as phantomjs regarding page customizations. E.g. you can't even set a header & footer
And exactly this was the initial reason I've chosen phantomjs. If you don't need those, a headless chromium is the best solution at the moment.
Yes, some features will require a bit more custom code. Headers/footers are tracked here: https://github.com/westy92/html-pdf-chrome/issues/16.
custom page header/footer can be achieved by using native css features that I'm sure modern chrome versions support: https://www.w3.org/TR/css3-page/#margin-boxes
@benjamine – have you tried using margin-boxes with Chrome though? It doesn't appear to work.
Headless chrome (puppeteer) now supports custom headers and footers (see headerTemplate and footerTemplate options). We've made the switch and it's definitely an improvement.
One issue to be aware of is that CSS margins override any margins passed to the page.pdf
API (https://github.com/GoogleChrome/puppeteer/issues/393).
I love this idea @marcbachmann !
Since Phantom.js had its maintainer step down and cited headless Chrome as one of the reasons, I have decided to start building a replacement library that uses headless Chrome, html-pdf-chrome.