This repository provides a Python script that generates a PDF based on the layer(s) contained in an Inkscape SVG file.
The script works as follows:
- It converts each layer of an Inkscape SVG into individual SVG files stored in
a temporary folder (
temp). This step is based on https://github.com/james-bird/layer-to-svg. - It converts each layer-SVG into a PDF using Inkscape.
- It merges all PDFs into a single output file.
By default, the script expects an input file named presentation.svg and
produces an output file named presentation.pdf. Both the input and output
can be customized with optional arguments.
The temporary folder (temp) is automatically removed at the end of the process.
You can run the script using:
python3 inkpres.py [--input 'path_to/svg_file'] [--output 'path_to/pdf_file']
-
No arguments provided:
Input defaults topresentation.svg, output defaults topresentation.pdf. -
Only
--inputprovided:
Output will automatically be named after the input, replacing.svgwith.pdf. -
Only
--outputprovided:
Input defaults topresentation.svg. Output must have a.pdfextension. -
Both
--inputand--outputprovided:
Uses the specified input and output files. Output must have a.pdfextension.
The script validates:
- Existence of the input file.
- Correct input (
.svg) and output (.pdf) extensions. - Output folder creation if it does not exist.
This repository is mirrored on both GitLab and GitHub. You can access it via the following links:
- GitLab: https://gitlab.com/maximelenormand/inkscape-presentation
- GitHub: https://github.com/maximelenormand/inkscape-presentation
The repository is archived in Software Heritage: