Tag Archives: SVG

Batch conversion of SVG to PDF (updated)

Thanks to Runbgmn for the original instructions on batch conversion of svg to pdf. The instructions there are currently out of date, so here are an updated set of steps I found to batch converting svg to pdf with Inkscape.

Batch conversion of svg to pdf is very helpful. This is how it can be done under Mac OSX for free, no need to buy any software nor upload anything.

The Setup for Batch Conversion of SVG to PDF

  1. Get the free vector graphics program Inkscape and install it
  2. We’ll want to make inkscape available as a command in our terminal path. To do so, In a terminal execute create a link:
sudo ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape /usr/local/bin/inkscape

3. Create a new file svg2pdf.sh with the following contents:

#!/bin/bash

# get path from command line
MYWD=$1

for file in *.svg
do
  echo $file $MYWD
  cat "$file" | inkscape --pipe --export-filename="${file%%.*}.pdf"
done

5. Make it executable:

chmod +x svg2pdf.sh

Usage

Run the script with the path to the folder filled with *.svg files to be batch converted to *.pdf.

Example:

bash svg2pdf.sh ~/Documents/folderOfSVGsToConvert

This will convert all svg files in the given directory into pdf.

Next you can use Adobe Acrobat, Preview, ghost script or many other programs to combine them into one single pdf file instead of multiple pdf files.

Combining Multiple PDFs into a Single PDF

Combining with Preview

The simplest way to combine multiple PDF files into a single one on Mac OSX is to using Preview.

A screenshot showing Preview application and how to open them thumbnails pane in the menu by opening View → Thumbnails or pressing Option + Command + 2. Which is handy for combining PDFs after batch conversion of svg to pdf files.
  1. Open the first page with Preview.
  2. Open thumbnails pane in the menu ViewThumbnails
  3. Drag and drop each PDF file into the thumbnail pane in the page order you’d like.

Combining with pdfunite

Install poppler, a PDF manipulation toolset.

brew install poppler

You’ll now have pdfunite command available, run it on your directory of PDFs to create a single PDF.

pdfunite *.pdf book.pdf

Speaking of Books

Looking for good engineering books? Take a look at my top rated engineering books I’ve found and recommend!