-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Text scaleFactor incorrect depending on the unit? #2781
Comments
As you can see here, the scaleFactor is set to a fixed value of Regarding the letter-spacing: could you attach screenshots and the output PDF? EDIT: This comment is incorrect! #2927 (comment) |
This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant. |
Sorry to bring up this old issue, but I'm wondering how to properly scale font. I can't seem to get the text sizes correct in the generated PDF. All of my html elements (images and text) are absolutely positioned and have
but based on your comment and looking at the linked issue, I decided to use
and then I re-calculated every elements
This is so that my html container is let's say Obviously the text needs to scale up, but I don't know by how much. Is there a way to grab the |
@cswkim font sizes are always given in |
I'm using the master branch of jsPDF in an iOS browser. My initialization is:
I want the PDF to mimic the text elements in my HTML which use px units. setFontSize() accepts parameters as pt values right? So if my HTML text element is 20px in css, what do I send to setFontSize()? 1px = 0.75pt? If so, shouldn't I be sending
15
? Is the original global unit setting in the constructor have anything to do with the setFontSize() method? I find that multiplying my css px value by ~1.6-1.7 gets the generated PDF to better match font sizing in my HTML. So if my html text element has font-size: 20px, I call doc.setFontSize(34) But that was just me constantly changing the multiply factor and eyeing the result. I'm trying to find an exact method. Also,letter-spacing
in css isnormal
by default, but I guess what normal means is defined by the browser. Not setting thecharSpace
option and leaving it as the default value of 0 also does not exactly match what gets generated in the PDF.Does the device PPI/DPI factor in? The dimensions of my HTML container element? The dimensions of the PDF page?
The text was updated successfully, but these errors were encountered: