Skip to content

Instantly share code, notes, and snippets.

@dvnoble
Last active September 10, 2018 15:51
Show Gist options
  • Save dvnoble/079d5d93a946af6aeafc8518adde492d to your computer and use it in GitHub Desktop.
Save dvnoble/079d5d93a946af6aeafc8518adde492d to your computer and use it in GitHub Desktop.
Simple bash script to batch convert svg files into pdfs. It doesn't mess with your fonts and requires rsvg-convert.
#!/bin/bash
# rsvg-convert is inside librsvg2-bin in ubuntu
for SVGFILE in *.svg;
do
SVGNAME="${SVGFILE%.*}";
rsvg-convert -f eps -o "$SVGNAME.eps" "$SVGFILE"
ps2epsi "$SVGNAME.eps"
ps2pdf -dCompatibilityLevel=1.4 -dEmbedAllFonts=true -dSubsetFonts=true -dEPSCrop "$SVGNAME.epsi" "$SVGNAME.pdf";
done
wait
rm *.epsi
rm *.eps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment