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
Letter spacing #1575
Comments
Nope. |
CharSpace parameter added to jspdf by #1433 Will be part of next release |
Just FIY |
doc.setCharSpace sets the charspace in the whole document. If you want to set the charSpace of a specific text you need to set it like I wrote above. |
@arasabbasi Could you please post an example of setting charSpace for specific text ? This sets charSpace for entire doc: |
Really? Hmm. Has to be examined |
After more than a year I examined it and figured it out, that it was indeed setting charSpace globally. Bugfix #2349 |
I'm on jspdf 1.5.3 but this:
still adds the charSpace throughout the whole document :-S instead of just on that line. Any idea why? |
It could be that this is fixed but not yet released. Could you test it with the file that are currently in the |
Hi, thank you for your answer. I'm a bit of a pleb. Could you explain in a few short steps how I can do that? I've tried the following: (my application is in node) I then tried importing it with:
Maybe I am doing it all wrong, idk :-S. |
I'd like to share something I discovered (see image). I will try to explain what I am doing. Basically I am generating an image with html2canvas of the page. Since this will not make the PDF searchable (no text is in the PDF) I manually add text with doc.text(). This works great, but there is something odd when the text that is rendered in the PDF contains a combination of "Te" or "Ye", it seems the charSpace for the character "T" and "Y" have more spacing so to speak compared to other characters. Basically what I am trying to say here is that there is a difference in "letter spacing/charSpace" between what the browsers displays and what is rendered when using doc.text(). Now I am rendering the text invisible that is drawn by doc.text() so it's not that big of an issue you'd think. But the offset would become larger and larger the more "T" and/or "Y" characters are being used in the document. I have also been trying to find a custom ttf font that works, but they all seem to be having the exact same issue. Perhaps it's an issue with "PDF" file type itself here? Any ideas? Anyway, I am probably going to have to do a work-around which would be: before generating the image with html2canvas I'd set any text to opacity: 0, to make it invisible in the image, and then draw the text on the location with a slightly smaller charSpace than the original text. It's not the best way of doing things, but I don't see any other solution for my problem right now. Any suggestion are highly appreciated as in what could be causing this, and if there is something else I could try . ps. the red text in the image is the drawn text with the use of doc.text(), and the grey text is from the image created with html2canvas. Thanks! |
@RensTillmann this could very well be a bug in jsPDF. Maybe it doesn't recognize the kerning between "T" and "e". |
@HackbrettXXX @RensTillmann Having some of the same issues. Found a solution yet? |
@olemp not that I know of. Would be awesome if you or someone else could look into that :) |
any solution in 2023? |
Did you find any solution? |
Hi,
Is there any way to change the letter spacing and reduce the original one?
Thank you.
The text was updated successfully, but these errors were encountered: