Skip to content

A simple command allowing to convert multiple SVG files into a single multi-paged PDF.

License

Notifications You must be signed in to change notification settings

pimpreneil/svgstopdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVGs to PDF

A simple command allowing to convert multiple SVG files into a single multi-paged PDF.

It is mainly based on librsvg and therefore, also on cairo.

In order to compile it on Debian-based systems, you will need the librsvg2-dev package as well as its dependencies. You can then simply execute make without parameters to compile as binary and then optionally make install to make the command available system-wide (copy in /usr/bin/).

This tool is more efficient than converting the SVGs into separate PDFs before merging them together as it does not duplicate font subsets.

Here is an example of use of this script:

svgstopdf 1.svg 2.svg out.pdf

The main purpose of this script is to avoid loading duplicate font subsets while including several vector images in a LaTeX document. After generating the PDF from various SVGs, you can load them easily using the LaTeX graphicx package:

\includegraphics[page=1]{out.pdf}
\includegraphics[page=2]{out.pdf}

Because this syntax using pages makes it hard to figure out which image is being included, an additional --latex-package option may be passed to the script in order to generate a LaTeX package that allows for easier integration:

svgstopdf 1.svg 2.svg out.pdf --latex-package

This command will generate an additional svgimages.sty that you must keep in the same directory as your generated PDF file as well as your LaTeX source files. Your LaTeX code to load the images will now become:

\usepackage{svgimages}

\includesvg{1.svg}
\includesvg{2.svg}

You may even pass some includegraphics-supported parameters:

\includesvg[scale=0.8]{1.svg}

About

A simple command allowing to convert multiple SVG files into a single multi-paged PDF.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published