1

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

Possible PDF

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?

Community
  • 1
  • 1
Kaha
  • 171
  • 4
  • 14
  • 1
    You're asking something that can't be done with iText. Look elsewhere. – Bruno Lowagie May 23 '13 at 06:57
  • Thanks [maestro](http://stackoverflow.com/users/1622493/bruno-lowagie)... I feel so to (with hope that "elsewhere" is exist:)... – Kaha May 23 '13 at 08:58
  • 1
    I think you'll have to combine technologies: first technology that pre-renders the HTML+CSS+JS; then technology that creates the PDF (that could be iText). One of the iText developers (Raf Hens) once showed me some products for the former, but that's not my area of expertise and I don't remember the names of those products. I'll send him a mail pointing at this question. – Bruno Lowagie May 23 '13 at 09:15

1 Answers1

3

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.

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
  • Thanks again maestro. I've just found [wkhtmltopdf](https://code.google.com/p/wkhtmltopdf/) and it seems good for this issue. – Kaha May 23 '13 at 11:45