Convert html+css+js to PDF

这一生的挚爱 提交于 2020-01-05 02:44:06

问题


I want to create something like this (code is here):

in pdf format. I'm using google charts and regarding to this forum converting chart to pdf is impossible. I've already tryied iText+XMLWorker, but there is some problem with css and any js supporting at all, I think.


So, the questions are: How can I convert html+css+js to .pdf file? Or, may be, the issue have other variants?


回答1:


As promised in the comment, I've asked Raf. This was his answer:

One way to use XML Worker for HTML+CSS+JS is to use a browser engine to preprocess the HTML. Examples of such a browser engine are WebKit (Chrome, Safari) and Gecko (Firefox). These can interpret the CSS and JS and give you HTML that is ready to be parsed by XML Worker.

Examples of competing products are:

  • wkhtmltopdf, a command line tool that uses WebKit as its rendering engine.
  • Prince XML supports HTML+CSS+JS to PDF using their own engine.

Maybe there are others, but this is what Raf told me. I hope this helps.



来源:https://stackoverflow.com/questions/16707410/convert-htmlcssjs-to-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!