21

I'm looking to programmatically convert SVG to PDF documents on a server. What are my options for doing that on Windows?

I've seen links to Inkscape, Batik, and svg2pdf, but I'm not sure if these can easily be automated to perform the conversion on a Windows server.

There's an unusual solution here which involves automating OpenOffice Portable on the server: http://www.codeproject.com/KB/office/PortableOpenOffice.aspx

Mark
  • 2,380
  • 11
  • 29
  • 49
Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
  • I've used inkscape to turn SVGs to images before, surely you could just embed the image in a PDF? – Ed James Jun 26 '09 at 09:51
  • 2
    I also want to retain the vectorness of the original SVG rather than simply rasterize it, so that rules out embedding images into PDF, or ImageMagick: http://imagemagick.org/Usage/formats/#vector – Matthew Lock Jun 26 '09 at 09:56
  • 1
    I'd love to see a .Net solution to this problem... gotta be one? – Brady Moritz Feb 22 '12 at 02:33

7 Answers7

20

There are two options:

  • Batik (Java, open source)
  • Inkscape (native binary, open source)

Batik will give you more control. With Inkscape, you can use the command line parameters (--export-pdf IIRC) to do the conversion without firing up the UI.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
5

Take a look at the Apache Batik Toolkit. The rasterizer can convert svg to images or pdf (It's a java tool).

The SVG Rasterizer is a utility that can convert SVG files to a raster format. The tool can convert individual files or sets of files, making it easy to convert entire directories of SVG files. The provided formats are JPEG, PNG and TIFF, however the design allows new formats to be added easily. In addition, the rasterizer can (despite its name) transcode to PDF.

räph
  • 3,634
  • 9
  • 34
  • 41
2

It does not come free, but PrinceXML does a very good job with SVG.

Vincent Buck
  • 16,462
  • 2
  • 21
  • 21
2

You can probably use Cairo and librsvg to read SVG into Cairo surface and export to PDF using Cairo. There are many bindings for languages and these are open source libraries.

arcanum
  • 697
  • 5
  • 9
0

you might want to look into Apache FOP.
Check out the part about graphic formats.

Mark
  • 2,380
  • 11
  • 29
  • 49
dertkw
  • 7,798
  • 5
  • 37
  • 45
0

You can use altsoft xml2pdf server for this

Jason
  • 1
  • 1
0

http://www.databasesandlife.com/svg-to-pdf/

Adrian Smith
  • 17,236
  • 11
  • 71
  • 93