This project aims to address the limitations of typst in handling certain special styles, such as SVG files with unique formats or gradients with transparency. By exporting your typst document to SVG format and then using this program, you can convert the SVG files to PDFs that support these special formats using the svg2pdf library.
- Converts SVG files to PDFs while retaining special styles.
- Merges multiple SVG files into a single document.
- Utilizes the svg2pdf library for rendering.
-
Export your Typst document to SVG format.
typst compile main.typ -f svg /path/to/output/{n}.svg -
Run the converter:
./target/release/pdf-postprocess <svg_directory>
<svg_directory>: The directory containing your SVG files.
./target/release/pdf-postprocess ./svg-filesThis command will convert all SVG files in the ./svg-files directory to PDFs and save them in the same directory. Additionally, it will merge all the PDFs into a single file named merged.pdf in the same directory.
- Migrated to svg2pdf: The rendering process has been updated to use the svg2pdf library.
- Migrated to librsvg: The rendering process has been updated to use the librsvg library instead of librsvg-rebind for a better development experience.
- Pipeline improvement: All rendering processes now flow in memory without generating intermediate files.
- Migrated to librsvg-rebind: The rendering process has been updated to use the librsvg library instead of the Chromium browser. This change makes the rendering process more lightweight and efficient.
- Base64 SVG Expansion: Added functionality to decode base64-encoded SVG images embedded within the main SVG file to prevent common bugs happens on librsvg.
This project is licensed under the MIT License.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.