Filed in: Tutorials.SVGPagesToSinglePDF · Modified on : Fri, 27 May 11
This tutorial details how to take a number of SVGs and compile them into a single PDF.
psmerge from psutils
ps2pdf from ghostscript
Lines 1–3 use Inkscape to export all SVGs to PostScript files. The fancy ${i%\.*} yields i minus the .svg so that we don't end up with .svg.ps. The -T switch is optional: it forces Inkscape to render text as paths; I find most programs don't render the flowText's that Inkscape uses natively well or at all.
Line 4 uses the psmerge command to merge all the PostScripts into one file. And pipes the output to...
Line 5 converts a Postscript to a PDF.
Actually, while this method "works", it isn't flawless: I was encountering problems with it adding a massive margin (like an extra inch) at the top of each page. I haven't determined why, but next is a fixed method.
Lines 1–3 are the same as above: use Inkscape to convert the SVGs to PostScripts.
Line 4 uses ghostscript to join and convert to PDF in one step.
Another method involves using the Image Magick convert command:
This is obviously much simpler and faster. However, two caveats: