SVG to PDF

13 June 2018

I’m using Yihui Xie’s most excellent bookdown package to create my courseguide for BUSINESS 705.

One problem I have is that I use SVG images. That’s all well and good when I am rendering the courseguide as an HTML book, but when I try and produce a PDF, bookdown (well LaTeX) chokes. It’s no one’s fault really. It’s just a fact of life.

So, I need to convert my SVG images into PDFs. That’ll fix the problem.

The way I do it is

$ inkscape mygraph.svg --export-pdf=mygraph.pdf

Easy!

I then created a Makefile to cycle through all the SVGs in the images director and convert them. I’m not sure how smart the Makefile is, but it works.

#
# Convert the SVG files to PDFs
#

SVGFILES := $(wildcard *.svg)

all: $(SVGFILES:%.svg=%.pdf)

%.pdf : %.svg
	inkscape --export-pdf $*.pdf $*.svg