Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SVGs #44

Open
PMunch opened this issue May 19, 2024 · 3 comments
Open

Adding SVGs #44

PMunch opened this issue May 19, 2024 · 3 comments

Comments

@PMunch
Copy link

PMunch commented May 19, 2024

I've been using this to create some PDFs for notebooks where I design the individual pages through a combination of scripts and manual SVG work. I then convert all my pages to PNG and have a script witch stitches them together as a PDF. However that requires me to select the DPI of the images when I convert them, it would be much better to add the vector graphics directly to the PDF. Would it be possible to add SVG support, or alternatively PDF-as-images support so I can convert my SVGs to PDFs and then lay them out with this?

@jangko
Copy link
Owner

jangko commented May 19, 2024

You need to write your own SVG renderer. Adding it to PDF is beyond the scope of a PDF writer.
you can see the example of converting SVG to vector graphics primitives here:
https://github.com/jangko/nimAGG/blob/devel/examples/svg_path_renderer.nim
it should be similar when using PDF api.

@PMunch
Copy link
Author

PMunch commented May 19, 2024

Hmm, fair enough. But what about converting the SVGs to PDF first, and then laying out the smaller PDFs in a larger one using this library?

@jangko
Copy link
Owner

jangko commented May 21, 2024

scale, move, rotate, stretch, skew, and setTransform + saveState and restoreState should work.
You do the transformation on the fly, not after converting to PDF. This is not a PDF reader library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants