5 ms·
Besides testing, my team uses phantomjs to convert pages to PDF and also to convert javascript generated charts to images. This is sad news, I'm don't think chr
by Hernanpm 10y ago
Besides testing, my team uses phantomjs to convert pages to PDF and also to convert javascript generated charts to images. This is sad news, I'm don't think chrome eventually will add support for.
- masklinn 10y agoYou can use WebDriver to take screenshots. OTOH I don't think there's any way to do PDF generation without fucking around with injecting window.print() and trying to go from there.
- egeozcan 10y agoThere's wkhtmltopdf[1] when you need the PDF functionality. It is licensed with LGPL, so you can make it interop with your commercial product. [1]: https://wkhtmltopdf.org/ https://wkhtmltopdf.org/
- throwaway2016a 10y agoSecond wkhtmltopdf ... I love PhantonJS but wkhtmltopdf is a better tool for PDFs.
- Hernanpm 10y agodid you have luck with SPA to PDF? I recall I tried it but with no luck for good javascript support.
- throwaway2016a 10y agoSPA as in Single Page Application? We are using it for reports and we are tailoring our HTML specifically to the reports so we haven't had that issue. If I needed Javascript it may not be the best solution. I like that it generates full PDFs (with real text objects) though not just a static image. I'm not sure if you can generate a PDF like that with PhantomJS. I haven't tried.
- Globz 10y agoI have been using it for almost 2 years on a production server to generate html orders to PDF on the fly, such an amazing tool.
- petercooper 10y agoAnd there's its sister project wkhtmltoimage for rendering to images as well :) Sadly, though, the browser seems way behind the times so I think Chrome will win the next round. I built a prototype library for rendering pages to animated GIFs using the Chrome debugging protocol, but headless will make it even easier: https://github.com/peterc/chrome2gif https://github.com/peterc/chrome2gif
- eknkc 10y agoWhile it's much better than PhantomJS, still causes a lot of issues. We run a paid pet project [1] for html to pdf conversion and most of our customers have stories beginning with PhantomJS then moving to wkhtmltopdf then finally going for something else due to issues with both. Headless Chrome might solve this issue once and for all though. [1] https://restpack.io/html2pdf https://restpack.io/html2pdf
- egeozcan 10y agoFor me the only issue was kerning with some specific fonts on windows servers. Do you have any other examples?
- deleted 10y ago[deleted]
- djd20 10y agoHey - what do you use for the pdf conversion specifically? We've been looking for something like this. Thanks in advance.
- HarveyKandola 10y agoWe recently ended up using NightmareJS with xvfb in Debian Docker image to produce high fidelity PDF's. Seems to work well so far.
- Flenser 10y agoChrome will have headless save to PDF fairly soon: https://bugs.chromium.org/p/chromium/issues/detail?id=603559 https://bugs.chromium.org/p/chromium/issues/detail?id=603559