How to programmatically convert SVG to PDF on Windows?

35,144

Solution 1

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.

Solution 2

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.

Solution 3

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

Solution 4

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.

Share:
35,144
Matthew Lock
Author by

Matthew Lock

Updated on May 31, 2020

Comments

  • Matthew Lock
    Matthew Lock almost 4 years

    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

  • Matthew Lock
    Matthew Lock almost 15 years
    Great Batik worked really well. Inkscape seemed to create a PDF that caused our printer to reboot when printed!
  • Christopher Bottoms
    Christopher Bottoms over 14 years
    Just a note: Batik doesn't convert SVG text to PDF text, at least as of October 2009.