Under Linux there aren’t many freely available vector graphics editors and as far as I know there are none that can edit EPS (encapsulated postscript) and PDF (portable document format) files. I produce lots of these files in my day-to-day work and I would like to be able to edit them. The best vector graphics editor I have found so far is Inkscape but it only reads SVG files… (Edit: recent versions can import PDFs but I’m not entirely happy with how text is imported; in particular, that fonts are not imported from the PDF.)

To overcome this problem I have written a very small utility to convert PDF files to SVG files using Poppler and Cairo. Version 0.2.3 is available here (with modifications by Matthew Flaschen and Ed Grace). This appears to work on any PDF document that Poppler can read (try them in XPDF or Evince since they both use Poppler).

So now it is possible to easily edit PDF documents with your favourite SVG editor! One other alternative would be to use pstoedit but the commercial SVG module costs (unsurprisingly!) and the free SVG module is not very good at handling text… To install

      tar -zxf pdf2svg-0.2.3.tar.gz
      cd pdf2svg-0.2.3
      ./configure --prefix=/usr/local
      make install

To use

pdf2svg <input.pdf> <output.svg> [<pdf page no. or "all" >]

Note: if you specify all the pages you must give a filename with %d in it (which will automatically be replaced by the appropriate page number). E.g.

pdf2svg input.pdf output_page%d.svg all

Source code

A Git repository is also available on GitHub.


pdf2svg is packaged for various Linux distributions (including Ubuntu and Fedora) and is available via the different package managers.

Windows binaries are available from GitHub; both 32 bit and 64 bit versions are available.

To cross compile for Windows under Linux, simply install the relevant cross-compiler packages (for Fedora this is mingw32-cairo and mingw32-poppler and their dependencies) and then replace “./configure” in the compilation instructions above with “mingw32-configure”.


  • 2015-06-16 (v0.2.3): Minor updates.
  • 2013-07-18 (v0.2.2): Updated to use the correct renderer call — bitmaps should now appear at full resolution.


Copyright © 2007-2015 David Barton
Copyright © 2007 Matthew Flaschen; Updated to allow conversion of all pages at once.
Copyright © 2008 Ed Grace; Added GNU Autotools commands.

22 thoughts on “pdf2svg”

    1. Unfortunately I haven’t had much success in producing a statically compiled version yet. The normal options for doing it don’t seem to work for some reason.

  1. Hi,

    Installing pdf2svg required installation of poppler, cario & pixman.

    It order to fix the dynamic problem, I decide to install it locally on another RedHat 6.4 machine. I set all environment variable as I did in my successfully installation, but when
    I run in Poppler:
    ./configure –enable-poppler-glib
    I get :
    checking for CAIRO… no
    configure: error: “Cairo output is required to build glib frontend”

    1. You need to have installed Cairo before installing Poppler and make sure that “pkg-config –modversion cairo” returns a sensible version of Cairo (it gives 1.14.2 on my machine). Note: pkg-config is the mechanism by which other packages can work out what the correct compilation flags are to link against that library.

  2. Hi there,

    thank you for that awesome tool! I’m working on MacOS and just want to let you know (and everyone who’s interested) how to install pdf2svg on a Mac.

    Just use Homebrew (http://brew.sh/) and install needed packages before installing pdf2svg.
    In case of doubt which packages are actually missing just try “./configure –prefix=/usr/local”… the process will then check all required packages, an error will be thrown if any package is missing.

    In my case only poppler and cairo have been missing. So, you only have to install them using Homebrew.

    For example call in your terminal:

    brew install cairo
    brew install poppler

    All dependencies will be installed automatically. That’s it.
    Afterwards you can install pdf2svg as explained in the article above.

    Thanks again for sharing your knowledge and this useful tool. …This reply is all I can give you in return. 🙂

    Keep up the good work!


    1. …Ok, I’m stupid. Forget everything I wrote in my last comment.

      I just mentioned that even pdf2svg is part of Homebrew. Therefore you can install everything by just calling:

      brew install pdf2svg

      Cheers. And best wishes from Hamburg, Germany. 🙂


  3. I use Linux Linbertine O as the main font in some of my pdf files.
    I tried to convert them to svg files using your program
    but I found the text is slightly different from the original
    as if they were bolden.

    I also tried the latest version of Ghostscript after I came
    across this page:

    And it handled the conversion well. The result looks exactly the same as the original with all the text being vectorized.

  4. I want use pdf2svg for a multi-page PDF. With all the resources occur only once under defs and the pages in multiple Groups or intrinsically tags like “page”.
    There is also the command-line option all. But SVG contains always only the last page.
    Can you give me a hint how I can solve this problem with pdf2svg.
    Many thanks

    1. Hi, unfortunately pdf2svg only supports extracting pages as separate files. I’m not sure whether you can do what you want with the current version of Cairo. (Which is used to generate the SVG output.)

  5. I installed pdf2svg on a mac (os 10.11.3) using homebrew. It’s dependencies, such as fontconfig also got installed.

    However, when I try to convert a PDF (made with R) to SVG I get the following error:
    Fontconfig error: Cannot load default config file
    …and the in the resulting SVG all the text is missing.

    I checked the installation of fontconfig with homebrew and it all seems to be okay. I have “fonts.conf.bak” in the “/usr/local/etc/fonts” directory.

    Please help! I need to convert dozens of PDF plots for a manuscript to SVG, and I need to do it ASAP. Thanks!!!

  6. Hi David, thank you so much for the excellent tool! I’m trying to use it to convert a PDF to web pages and the svg images can be huge sometimes, like tens or hundreds of megabytes, which crashes depending on what the browser is running on. Any advice?

    1. Sadly SVG isn’t the most efficient of formats and also the automated translation between formats doesn’t tend to help matters. There’s not a lot that can be done. That said, if your PDF contains lots of bitmap images it might be better to split them out from the PDF as binary jpegs and include them in the web page directly. (You can use utilities such as pdfimages to get the original jpegs out of the PDF.)

  7. Thanks for the wonderful tool. I noticed that the text is not rendered as an SVG text. Instead, it’s being rendered as a path.
    Any possible way to render as a text?

    1. Unfortunately not with the current versions of Poppler and Cairo (the libraries that this program uses to render the PDF).

  8. I am trying to upload the created .svg file to makercam.com but when I do so it only shows as a line. Any suggestions would be very helpful. Thank you

  9. I want to upload the output svg to makercam.com but it uploads as a horizontal line and nothing else. Do you have any idea why this might be?

    1. Yes, it should handle text fine. Though you will get a vector graphic version of the fonts rather than editable text. If you want editable text, the best thing to do is to load it into Inkscape, however, it often results in changes to the font unless you have exactly the right font installed on your computer.

Leave a Reply

Your email address will not be published. Required fields are marked *

Homepage of Dr David Barton