How to: Make a PDF Book with Inkscape

On Monday I created a book which I posted to this blog in draft form, I created each page in inkscape.

Today I want to share some of the tips and tricks I picked up doing this mini project.

So first, Inkscape doesn’t yet support (0.46) the ability to have multiple pages. It’s also not got any functionality to append to a pdf or to collate documents into a pdf file, so your stuck creating single pdf files. But this isn’t as much of a problem as it may at first seem, in fact the inkscape scriptability from a CLI makes it easier.

You’ll also have to be aware that the Cairo export from svg to pdf isn’t perfect, things like shading, bluring and other effects will disapear if not cause outright blemishes. Be sure that any svgs you import have been stripped of fancy blending. I had to do this manually for a few human icons I used.

Select a single size for your document, I created mine as a 640×480 slide format with a standard header and border. This was because I wanted this to be most useful on screens.

Make sure to prefix a padded number to each page filename e.g. 01, 02… because later we need to make sure that all the pages appear in the right order.

Reuse, I reused a ton of graphics over and over, sometimes complex graphics can make things seem too fancy. The man with a white arm is about as basic as you can get while including a direction and a few pose-able ideas such as need, want, have, offer, get, select etc. A friend from the inkscape irc channel did create some more complex figures, but I decided that they increased the busyness of the pages too much.

Create a pallet svg with all your reusable graphics and import it to each new frame. In my version of inkscape there was a bug that prevented copy and paste from working, so I improvised with a pallet file.

Once you’ve got all your svg pages, you’ll want to create pdfs, I used inkscape on the command line to make a pdf from each svg: `inkscape -A file.pdf file.svg`

Now you have a load of pdf files, next I used pdftk to gather all the pdfs together into a single pdf file `pdftk 01-file.pdf 02-file.pdf … output file.pdf`.

I was also creating an archive of each version that people could use, and cleaning up all those single pdfs afterwards.

This is the script I ended up making to allow all my pages to be collated into a single pdf:

#!/bin/bash

rm ../understanding-foss.pdf

ls *-*.svg | xargs -i1 inkscape -A 1.pdf 1

pdftk *.pdf output ../understanding-foss.pdf

tar cjvf ../understanding-foss.tar.bz2 *.svg make-book.sh

rm *.pdf

Hope this helps others create some useful documents.