I've been converting HTML + CSS to PDF in server-side Java, e.g., Flying Saucer (http://code.google.com/p/flying-saucer/)
Now I need to look at alternative approaches with the growth in client-side visualization APIs like RaphaelJS, that should also be included in PDF exports.
Ideally, I would just have a print-friendly layout and CSS (kind of like Google maps does) and there would be some magic way that a Javascript call could silently "print" the window to a PDF file, rather than having a separate PDF generation pipeline.
Is there any such thing?
If not, what other approaches would you recommend?
For example
- run Raphael server-side with node.js or Rhino, use Batik to convert SVG output to image, render PDF server-side
- same thing but do some hack to grab SVG from the work that Raphael already did client-side
- Do a headless-browser on the server, like wkhtmltopdf or phantomjs, to capture and execute the generated HTML/JS server side.
Any success with any of those approaches or other suggestions?