I have a directory of about 1000 svg files in svgz extension, which resembles a textbook. An example of the svg files can be found here.How would I merge the files into a PDF while preserving as much quality as possible?

As you can see in this imageenter image description here, the PDF rendering of the svg is incomplete, but a quicklook view or opening it in chrome renders it completely. Google Drive preview also does not render it completely.

  • Are both sets of files (SVG and HTML) required for the PDF, or only one set? If both, how do they need to get combined? What are you using to view/render them currently? Are you looking for a ready-made solution or do you have some coding experience so you could create something once you know which tools to use?
    – nohillside
    Dec 5, 2019 at 10:16
  • Also, I just had a look at the files: neither the SVG nor the HTML files as such provide enough information, it seems that parts are missing.
    – nohillside
    Dec 5, 2019 at 10:57
  • From what I see the information in the SVG and HTML files is not enough to reconstruct the content. You can easily check this by opening some of the HTML files in a browser
    – nohillside
    Dec 5, 2019 at 11:52
  • There are pages where you only have the html, and some where you only have the svg. And where you have both I don‘t see how they relate together
    – nohillside
    Dec 5, 2019 at 12:10
  • You can check this yourself, by looking at the source. Take page 173 for instance, the HTML file doesn't reference the SVG at all, so I assume that there is some Javascript or another (unknown) way to combine this.
    – nohillside
    Dec 5, 2019 at 14:15

2 Answers 2


Based on nohillside's answer and Matthieu Riegler's answer, this is my solution:

cd /
for i in /path/to/folder/*.svgz
    /Applications/Inkscape.app/Contents/Resources/bin/inkscape $i --export-pdf $i.pdf
cd /path/to/folder
launchctl limit maxfiles 10240 10240
ulimit -n 10240
pdfunite *.pdf book.pdf

Assuming that the information in the SVG files is enough to rebuild the book (which isn't, as far as I can see):

Install Homebrew by visiting brew.sh and following the instructions, and then run

brew install imagemagick
brew install poppler

cd SVG-Folder
for i in *.svgz; do magick convert "$i" "${i%%svgz}pdf"; done
pdfunite *.pdf book.pdf
  • This did not work for me. See the updated question.
    – Joy Jin
    Dec 9, 2019 at 6:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .