Convert PDF to SVG by command line

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
eugene8
Posts: 1
Joined: Tue Aug 09, 2016 10:37 pm

Convert PDF to SVG by command line

Postby eugene8 » Tue Aug 09, 2016 10:59 pm

I use Inkscape on Windows and going to use it on Debian for convert PDF to SVG by the command line. With GUI Inkscape work very well, I can import PDF via Poppler, but i can not do it by command line, Inkscape convert PDF image to text and the picture looks bad.

This is my command line:
--without-gui --file my.pdf --export-text-to-path --export-plain-svg=my.svg

This is PDF
Image

This is result SVG
Image

Is it possible to do a good conversion by the command line? :cry:

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: Convert PDF to SVG by command line

Postby theozh » Wed Nov 23, 2016 10:59 pm

Hi,
somebody made me aware of Windows-"Standalone" Version of Poppler...
http://blog.alivate.com.au/poppler-windows/

Go to the \bin directory and start pdftocairo.exe
Command line usage:

Code: Select all

pdftocairo.exe -svg "Input.pdf" "Output.svg"

So, there is no need anymore to use Inkscape for conversion of PDF to SVG ;-)
It worked for me (as far as I have tested). Although, I noticed very small distortions in the SVG. And text is obviously converted into Paths.
Hope, it works also for you.

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: Convert PDF to SVG by command line

Postby theozh » Thu Jan 05, 2017 1:51 am

Your result looks like Inkscape does not find the proper font and replaces it with some other font.
The formula looks to me like it's from LaTeX which uses a Type 1 Font.
So, I am just guessing that Inkscape does not know to handle such Type 1 Fonts. If you type your formula e.g. with LibreOffice Formula Editor (of course it doesn't look as good as LaTeX ;-) ) which is using TrueType Fonts and make a PDF out of it, the following command line conversion works under Win7 (cmd.exe), but apparently not for Type 1 Fonts.

Code: Select all

inkscape -z -f "Input.pdf" -l "Output.svg"

So for your task, the above mentioned Poppler-Standalone seems to be the preferred solution.
Win7/64, Inkscape 0.92.2


Return to “Discuss Software Issues”