marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 543 forks source link

Phantom.js-free replacement with headless Chrome #309

Open westy92 opened 7 years ago

westy92 commented 7 years ago

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.

marcbachmann commented 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.

westy92 commented 7 years ago

Yes, some features will require a bit more custom code. Headers/footers are tracked here: https://github.com/westy92/html-pdf-chrome/issues/16.

benjamine commented 7 years ago

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

kjantzer commented 7 years ago

@benjamine – have you tried using margin-boxes with Chrome though? It doesn't appear to work.

SystemParadox commented 6 years ago

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).

isaiahtaylor commented 6 years ago

I love this idea @marcbachmann !