12

When I have a directory full of .svg files, e.g. from Inkscape, how is it possible to convert them to .pdf files?

Similar to this approach for a single file, but as a batch command for a whole directory.

user36028
  • 421
  • 4
  • 9
  • 1
    Possible duplicate of [How do I convert an SVG to a PDF on Linux](https://superuser.com/questions/381125/how-do-i-convert-an-svg-to-a-pdf-on-linux) – n8te Jan 10 '19 at 09:21

1 Answers1

18

In this post, the procedure is shown for a single file.

The relevant command is:

rsvg-convert -f pdf -o t.pdf t.svg

For a whole directory, a simple bash script does the job:

for i in *.svg;do rsvg-convert -f pdf -o ${i%.*}.pdf $i;done

This assumes that you have rsvg-convert installed, if not you can get it by typing:

sudo apt-get install librsvg2-bin
user36028
  • 421
  • 4
  • 9
  • 2
    How do you convert the whole directory's svg files into a single pdf file ? – DevonDahon Apr 09 '20 at 21:54
  • The simple approach is to merge all the generated pdfs. See: https://askubuntu.com/questions/886934/merge-all-pdf-files-from-one-folder Command: pdftk *.pdf output mergedfiles.pdf – user36028 Apr 09 '20 at 22:25