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.

53 Replies to “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. 🙂


      1. When I tried brew install pdf2svg I got
        Error: No available formula for pdf2svg
        I am running OSX 10.11.4.

  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.

  10. Hi,
    we have problems with creating svg files on a Gentoo system with pdf2svg. Some shadows look strange on the svg files. I uploaded two pictures to show the problem:

    It works fine on Debian, Ubuntu and Suse. Only Gentoo seems to make those problems.

    Any ideas how to fix the problem?
    Any ideas how to debug the problem?

    Those versions are currently installed on the Gentoo system:
    – media-gfx/pdf2svg-0.2.1:0
    – app-text/poppler-0.42.0:0/59
    – x11-libs/cairo-1.14.2:0



    1. That sounds strange since those packages are very recent. Sorry, I’m not sure what could be the issue.

  11. Hi,

    Error facing while install pdf2svg on centos 6.5

    checking for POPPLERGLIB… no
    configure: error: Package requirements (poppler-glib >= 0.5.4) were not met:

    No package ‘poppler-glib’ found

    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.

    Alternatively, you may set the environment variables POPPLERGLIB_CFLAGS
    and POPPLERGLIB_LIBS to avoid the need to call pkg-config.

    Please help how to setup the poppler-glib for pdf2svg.

    1. Hi,

      SVG scaling is done entirely in the SVG viewer you are using. It’s a vector graphic so you should be able to scale it arbitrarily.

      1. Your program is very good and useful. But the scale parameter would be very helpful. Sometimes it is not possible to specify the size of the picture, for example when the picture is embedded on a web page. To specify the image size in html attributes I should know in advance its size. It is difficult to implement. Scaling will make the images so that all images look proportionate to the text on the web page.

  12. I have been using pdf2svg for a couple of weeks and it generally does a great job. I’m using it to convert pdf files that people are uploading to a web site in an educational environment.

    However I’ve just run into a short document that doesn’t convert properly. The output produced by pdf2svg appears to include the original pdfs images but not the text.
    I have tried xpdf and the result is fine.

    I’d very much appreciate any suggestions as I suspect that the issue is going to recur.

    Just for information, xpdf does output the following warning which I guess may be important:
    Warning: Cannot convert string “-*-helvetica-medium-r-normal–12-*-*-*-*-*-iso8859-1” to type FontStruct
    Warning: Cannot convert string “-*-courier-medium-r-normal–12-*-*-*-*-*-iso8859-1” to type FontStruct
    Warning: Cannot convert string “-*-times-bold-i-normal–20-*-*-*-*-*-iso8859-1” to type FontStruct
    Warning: Cannot convert string “-*-times-medium-r-normal–16-*-*-*-*-*-iso8859-1” to type FontStruct

    I also tried pdf2ps and generated a perfectly good .ps file but I did get this warning:
    **** Warning: considering ‘0000000000 XXXXX n’ as a free entry.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by:
    **** >>>> Mac OS X 10.10 Quartz PDFContext <<<<
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe's published PDF
    **** specification.

    1. It sounds like your PDF file is corrupt; unfortunately there isn’t a great deal you can do in that situation. Occasionally converting it from PDF -> PS -> PDF fixes things but no guarantees.

  13. This is very spiffy. It allows me to make a slideshow in PowerPoint on the Mac, export it to a PDF, and then make a set of SVGs!

    They turn out at the proper size/dimentions/layout. And they even handle raster images properly.

    The only issue I have is automating making every page in the PDF into a single SVG.

  14. Great tool, but would it be possible to add the text as metadata into the SVG output in a next version? I understand that that might be quite a challenge, but having only the paths sort of defeats the whole purpose of conversion to SVG. It could even be put into a hidden object with a mouseover function to put the text on screen, to make it at least copyable.

  15. Was using this and ran into a bug with Cairo’s svg output, but in the midst of debugging I found out poppler-utils includes a pdftocairo utility ‘pdftocairo -svg input.pdf output.svg’, so I’ll probably use that once I figure out the bug.
    Thanks for the utility though, it’s nice and easy to find in the Debian repos, ‘pdftocairo’ is a bit more obscure when you just want svg output.

  16. Ciao David,
    well, I have a dream… a switch `–randomize` so that instead of

    I will get

    where `RAND` is (likely) unique in every generated file.

    This could help mitigate the problems with multiple SVG images inlined in the same HTML document (please see e.g. https://stackoverflow.com/questions/16123721/how-to-use-local-defs-in-svg or https://github.com/jupyter/notebook/issues/333).

    What do you think? is it not worth the hassle because everyone should be able to fix the issue with a script or is there a gain because of the global reduction of duplication of effort?

    Thank you for pdf2svg, it’s an amazingly useful tool that I use it not so much to edit PDF files via inkscape but rather (you guessed?) to inline images created with PDF tools in my pages.

    1. Ooops, it seems like your comment machinery doesn’t like indented blocks to represent code. However.
      What I have in mind is producing e.g. ” instead of ”, where ‘RAND’ is repeated across all the identifiers in a single file.

  17. in centos7 ,the software can not use “yum install pdf2svg”.i install it with your method.but,it trans the svg to big.but in ubuntu is small

    1. This is likely to be due to the Poppler and Cairo libraries that are bundled with Centos; I presume the Ubuntu versions are newer (and more efficient).

  18. I’m trying to run a loop, but i’m getting ‘unable to open file’

    if I don’t use the loop, it works fine

    Broken: forfiles /m *.pdf /c “pdf2svg.exe @file @fname.svg 1”
    Works: pdf2svg.exe test.pdf test.svg 1

    1. Unfortunately I don’t know how forfiles works (is it a Windows thing?) so I can’t really help… Do any of your file names have spaces in them? If so that can cause problems unless you put the filenames in quotes.

  19. I want to integrate it into the windows program written by golang, without having to let users install pdf2svg, what should I do?

    1. You could use the Poppler and Cairo libraries directly from golang – pdf2svg is really just a very thin wrapper over the top of them both.

  20. I’m trying to install this on OSX High Sierra, and am running into the problem with ./configure: after making sure that pkg-config is available, running the configure script dies on “checking for CAIRO… no”, even though cairo 1.16.0 is very much installed. Both pkg-config and cairo were installed using `brew`, but where pkg-config is found, cairo is not.

    (And perhaps fun to know, I’m using pdf2svg as part of the build step for https://pomax.github.io/bezierinfo, where it is used to make LaTeX look good by running it through xelatex, then pdfcrop, then pdf2svg)

  21. Thank you for this. My reason for wanting this though isn’t in order to edit PDFs, but because Ghostscript does not support SVG as an output format. So, if I want to make a diagram using PostScript code and make it in SVG format, then I can tell Ghostscript to produce PDF output and then use this program to convert PDF to SVG. However, another comment says apparently it converts text to paths and not to text; it would be better to have an option to switch this (since both ways are something you might want). Better would be to patch Ghostscript to produce SVG output directly, though, I think (that would also give the ability to convert PDF to SVG, since Ghostscript also supports PDF as an input format too, in addition to as an output format).

  22. Hi,
    first of all, thank you for this useful tool.

    We use pdf2svg on a old Debian 7 server and also on Debian 8 and Ubuntu 18.04.
    We converted a quite complex pdf file to svg. On the Debian 7 computer we got a round about 5 MB svg file. On the Debian 8 and Ubuntu 18.04 computers we got ca. 50 MB big svg files. Those svg file seems to have a much better resolution, the picture is more clear and crisp.

    Now we wonder, where did the change happen, is there a way to adjust the quality of the output.

    If I understand correctly, there is no way to change it directly in pdf2svg, but maybe there is a way to change it in poppler or in cairo. The easy way would be by adjusting parameters. The not so easy would be to recompile one of the libraries.

    Any idea where to start or maybe even how to do it?

    Thanks again,


    Debian 7:

    pdf2svg 0.2.1-2+b3
    libcairo-gobject2:amd64 1.12.2-3
    libcairo-perl 1.090-2
    libcairo-script-interpreter2:amd64 1.12.2-3
    libcairo2:amd64 1.12.2-3
    libcairo2-dev 1.12.2-3
    libpixman-1-0:amd64 0.26.0-4+deb7u1
    libpixman-1-dev 0.26.0-4+deb7u1
    libpoppler-glib8:amd64 0.18.4-6
    libpoppler19:amd64 0.18.4-6
    poppler-data 0.4.5-10
    poppler-utils 0.18.4-6+deb7u1

    Ubuntu 18.04

    pdf2svg 0.2.3-1
    libcairo2:amd64 1.15.10-2ubuntu0.1
    libpangocairo-1.0-0:amd64 1.40.14-1ubuntu0.1
    libpixman-1-0:amd64 0.34.0-2
    libpoppler-glib8:amd64 0.62.0-2ubuntu2.10
    libpoppler73:amd64 0.62.0-2ubuntu2.10
    poppler-data 0.4.8-2

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.