-
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
Support for units #154
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, svg2pdf does not support units (except for some rare exceptions) and treats every dimension value as in PDF units. The PDF unit is specified in the jsPDF constructor (e.g.
new jsPDF({ unit: "mm" })
).We should really support different units.
Resources:
In order to implement this, we should add a method to the
Context
class that converts a dimension value with unit into a unit-less dimension value. For relative dimensions there is already aviewPort
property on theContext
with the current viewport.In order to implement units by specification, we should also factor out the PDF unit/scaleFactor, meaning we need to
pdf.internal.scaleFactor
.pt
). The factor is72/96
. See also here.We can combine these factors to a matrix that is applied once "around everything" in the
svg2pdf
method.After this we can replace/remove the
toPixels
method in the utils/misc file.The text was updated successfully, but these errors were encountered: