

Ask HN: SVG to PDF on a shared linux server - dflock

I have a website which uses SVG for an interactive client side thingamabob. I would like to provide the option to download a PDF of the finished output. I can pass the final SVG output back to the server, where I want to convert to PDF, then return it to the client for download.<p>This would need to work on a headless shared linux server, where installation or compilation is either an enormous pain, or impossible. The website is PHP, so the ideal solution would be PHP, or use software that's easily installed on a shared webserver. Python, perl and ruby are available, along with the usual things you might expect on a linux box. Solutions that involve cairo, scripting inkscape, or installation more complex than 'FTP it up' are probably out. Spending large amounts of money are also out, naturally.<p>The nearest that I've got so far is this (http://code.google.com/p/lindenb/source/browse/trunk/src/xsl/svg2ps.xsl) XSL transform which I can drive from PHP and then squirt the resulting postscript through ps2pdf (which is already installed). The only problem with this is that it doesn't support paths - if it did, it would be perfect.<p>Does anyone have an off the shelf solution to this, or should I just spend some downtime adding paths support to that XSL transform?<p>Thanks,
Dunc
======
andrewcooke
You can use Batik - see <http://xmlgraphics.apache.org/batik/#uses>

[edit: and that actually uses <http://xmlgraphics.apache.org/fop/>]

~~~
dflock
Batik (which FOP uses if you feed it SVG) is probably too memory and CPU
hungry for this - hogging processes tend to get killed on shared servers.

