Forum Feature requests

SVG to PDF

felipellrocha
Is there anyway we could get jpg versions of all the svgs rendered via Prince?

I'm looking for something like, if we run ./prince test.html -o test.pdf --external-jpg, and the file was:
<html>
<body>
<svg id="1"></svg>
<svg id="2"></svg>
</body>
</html>


We'd get back the pdf "test.pdf", and the images, "test.1.jpg", and "test.2.jpg".

I'm using prince to render all our svg charts for our clients. Sometimes, though, a client might want to download the graph separately, along with the pdf. I figure you guys have to convert all svgs into some sort of image format either way, I guess I'm just asking to save those images in a separate format along with the pdf. :)

Thanks,

- Felipe Rocha
mikeday
Actually, Prince renders SVG using vector drawing instructions inside the PDF, which keeps the file size down and allows you to zoom in and see that the lines and curves are still smooth and not jagged.

What you could do is use Prince to convert each SVG to a separate one page PDF file, then use a tool like pdftoppm or ImageMagick to convert the PDF to JPEG. Alternatively, you could use an SVG renderer like Batik to convert the SVG to JPEG directly.