automatically generate PDF from documents containing dynamic SVG drawings

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

automatically generate PDF from documents containing dynamic SVG drawings

msin
We have developed some custom controls using SVG drawings using SVG components like lines, text and such. These are dynamic svg drawings using dynamic data from the persistent layer (and they are not static images).  And currently the custom controls do display the desired graphics and text in template and document correctly.

And we also want to use the PDF export function in Orbeon, the url target with ../pdf/.. to automatically batch-export documents into pdf files. We face the issue where svg drawings are missing in the PDFs, possibly because PDFs are generated on the server side, and the svg drawings usually happens on client side. Also other posts on this forum mentions that Orbeon printing/pdf processor doesn’t convert SVG components into equivalent PDF components.

My questions are,
1. is it possible to auto-generate or batch-generate PDFs from documents that contains svg drawings?
2. if yes, what is the best approach to batch-generate PDFs from documents containing dynamic svg drawings (or canvas drawings)?

Thanks,
Mei
Reply | Threaded
Open this post in threaded view
|

Re: automatically generate PDF from documents containing dynamic SVG drawings

Erik Bruchez
Administrator
Mei,

The PDF processor we use does not support SVG at all. So currently, the answer is that it's not possible.

When the PDF is produced, components run (but JavaScript doesn't). So if your components produce the SVG, then that will be available just before the PDF processor. Rendering the SVG would the require hooking up an SVG processor right there (maybe Apache Batik https://xmlgraphics.apache.org/batik/), which would render them as images, and the images would be embedded in the PDF.

So I can see how that would be doable, but it's a small project!

-Erik