# How to convert an SVG to a PDF on Linux

conversionpngsvg

How do I convert and SVG (containing a a few words of latin text and some simple vector graphics) to a PDF on Linux?

I tried Inkscape 0.47 on Ubuntu Lucid, but it moves some sub-graphics randomly, and it makes some lines shorter in the output PDF. So it's output is useless, because the graphics looks completely different.

I tried opening the SVG in Google Chrome 16 and printing it to PDF, but it distorts all the colors, and it also removes some elements. (The SVG appears fine on screen, but it's already bad in the print preview and the generated PDF is also bad.)

I don't want to rasterize or render the SVG. A solution which converts the SVG to a bitmap image and then creates a PDF with the image embedded is not an answer to my question. (FYI Inscape 0.47 renders the text is a very ugly way, without antialiasing, when rendering to PNG.)

What other options do I have?

rsvg-convert did the trick for the SVG I wanted to convert:

$sudo apt-get install librsvg2-bin$ rsvg-convert -f pdf -o t.pdf t.svg


rsvg-convert -f pdf doesn't rasterize the SVG, and it embeds and subsets fonts (at least it has embedded the used characters of the Arial font). Sometimes font embedding fails (e.g. for the LMRoman17 font), and the whole font file gets copied to the generated PDF.

Dependencies on Ubuntu Lucid:

• libcairo.so.2
• libgobject-2.0.so.0
Note: The man page of rsvg-convert states that the tool always rasterizes, but this isn't true. The manual is simply obsolete. Sometimes your svg generating tool can partially rasterize the svg image, which can also mislead you.