3

I was looking at the answer to the question (converting EPS to PDF) where they suggested using Inkscape to convert EPS to PDF images. I need the exact same thing. Using the GUI, it works like a charm.

Since I have about 200 images to convert, is there a way to automate this process? Or at least run it via command line so that I can do this process faster? Even doing it one at a time from command prompt is fine because doing this from GUI is becoming a pain.

I'm learning Batch scripting so with any given answer can you elaborate to how the proccess works

I have read the page on running Inkscape on the command prompt but I'm getting the error that 'inkscape' is not recognized as an internal or external command, operable program or batch file.

I asked this question over at the TeX StackExchange site and was asked to run the following batch script.

@echo off

for /r %%i in (*.eps) do "c:\Program Files (x86)\Inkscape\inkscape.exe" --export-pdf=%%i.pdf %%i

When I navigate to using cmd to the directory I get the error

Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected.

But Inkscape just opened and nothing happened after that. Could someone please help me?

2
  • 1
    Run the script with >> output.txt at the end of for /r %%i in (*.eps) do "c:\Program Files (x86)\Inkscape\inkscape.exe" --export-pdf=%%i.pdf %%i and it will output the errors to a text file
    – 50-3
    Sep 10, 2013 at 23:14
  • 1
    Also for /r %%i in (*.eps) do echo "c:\Program Files (x86)\Inkscape\inkscape.exe" --export-pdf=%%i.pdf %%i >> output.txt will output each line that the batch file tries to run into a text file so you can see each line and debug from there
    – 50-3
    Sep 10, 2013 at 23:16

2 Answers 2

7
  • Don't use inkscape.exe. Use the inkscape.com wrapper. This will allow you to see output and error messages from the Windows command line. See this FAQ entry

  • Try explicitly using the -f option to see if that makes a difference, ie. change:

    --export-pdf=%%i.pdf %%i
    

    to

    -f "%%i" --export-pdf="%%i.pdf"
    
  • Test a single file with backslashes in the path to make sure Inkscape is okay with it. If not, you might need to convert to forward slashes.

1
  • Thank you... but oh wow... Is there a single step in the process of importing svg into pdf files that is not painful?
    – Domi
    Jun 26, 2022 at 7:42
1

With the /r option of for, you are getting a recursive list of all the .eps files in that directory and subdirector(y/ies), with the value of %%i = c:\some\path\probably with\spaces\someEPSfile.eps.

Inkscape is probably choking on those unexpected spaces in the filename. It can probably be fixed like this:

for /r %%i in (*.eps) do "c:\Program Files(x86)\Inkscape\inkscape.exe"
--export-pdf="%%i.pdf" "%%i"

If that doesn't work, then I would try removing the recursive flag (maybe Inkscape doesn't like slashes in it's filenames?):

for %%i in (*.eps) do "c:\Program Files(x86)\Inkscape\inkscape.exe"
--export-pdf="%%i.pdf" "%%i"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .