-
Notifications
You must be signed in to change notification settings - Fork 104
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
Embed images with SVG #287
Comments
Thank you for the bug report. It appears the SVG image is part of the exported PDF but is at the wrong location. Could you provide an example with an image tag linking a much simpler SVG that still reproduces the issue? |
Sure ! Here it is ! |
Thanks. I could not reproduce the issue with the sandbox, though. There is a bug in your code:
should be
Otherwise, we're just exporting the first SVG. After I fixed it, the exported PDF looks fine. |
Hi ! Sorry for the mistake, I might have rushed the second example a little. On the browserThe SVG to export scales down the second SVG so that it fits within the view On the exported PDF:Both SVGs are rendered in their original scale, and cropped within the view. |
Thank you. I can reproduce it now. It seems like this is an issue with the viewbox transformation being applied incorrectly. If I add a viewBox attribute to the referenced image, the result is correct. I suspect the fallback case here is wrong: Lines 71 to 83 in 2682632
I'm not sure what the expected behavior is if no viewBox attribute is provided. I couldn't find much on a quick scan through the SVG spec. I'll accept a pull request for this issue. A workaround for now might be to always set the viewBox attribute. |
Describe the bug
tags with an href pointing to a SVG file are not displayed correctly
What version are you using (exact version of and jspdf)?
- jspdf: 2.5.1
- svg2pdf.js: 2.2.3
To Reproduce
Code:
Example Sandbox
Expected behavior
The SVG image should be drawn
Screenshots
Input SVG:
Output PDF:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: