You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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" })).
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 a viewPort property on the Context with the current viewport.
In order to implement units by specification, we should also factor out the PDF unit/scaleFactor, meaning we need to
apply the inverse scale factor. We can access the current jsPDF scaleFactor like this: pdf.internal.scaleFactor.
apply a scale that converts between CSS pixels and PDF user space units (pt). The factor is 72/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:
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: