When you need to convert an SVG file to PDF format (for inclusion into a document, for instance) you can take several options:

  • ImageMagick “convert” command will produce a raster PDF instead of a vector one. This may be enough for you and it is convenient, because it is command line based, and therefore scriptable
  • Inkscape can load the SVG file and then you can export it as PDF. This will generate a vector PDF, which is great because it is scalable, but using a GUI-based solution can be fastidious if you have to convert a bunch o files.

Today I discovered that you can have both advantages (command line and vector PDF) using Inkscape. Just use the  “–without-gui” option as follows

inkscape –without-gui –file=filename.svg –export-pdf=filename.pdf

4 thoughts on “svg2pdf”

  1. Inkscape is nice but it’s not always installed on a server – but then neither is ImageMagick :) Anyway, if you’re converting vector files with ImageMagick you need to specify the density to give the rendering engine a better idea of what size to make the target. This effects how clean it will look.

    something like
    convert -density 300 source.svg target.pdf

    gives better results. NB the Inkscape pdf will be ***way*** smaller in file size (6k versus 6 MB for ImageMagick). Now everyone go file bugs and feature requests on the ImageMagick site :)


  2. Maybe this link will be useful:

    It’s a simple *.jar file which (once Inkscape is installed in your PC) will automagically convert your SVG files to PDF in the same way as you’d do from GUI.
    That’s my two cent.
    BTW, converting to PDF from SVG please be advised that a severe issue has been discovered in latest Inkscape ( with Cairo library 1.11.2) which eventually will put random characters in your output PDF (I’ve been fighting against this issue for the last 2 days…); also note that the wrong characters won’t be visualized in output pdf…so you have to search for some text to discover and reproduce the issue.

    So please use Inkscape 0.48.2 which makes use of Cairo lib 1.10.2; this version works fine.

Leave a Reply