-
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
getTextDimensions not working in case of multiline text #1933
Comments
getTextDimensions is using fontSize as far as i know. How do you calculate the height. Do you have some code? |
do we have any option to pass font size as parameter to getTextDimensions() and when ever iam doing getTextDimensions of multilinetext it is not giving the correct result ? how should i use it for multiline text as i had a need to calculate previous text content and place the newer ones.Thanks for your speedy response @arasabbasi |
Sorry iam still trying all the features so may the previous example may be confusing and clustered take this var head2Text = doc.splitTextToSize(head2FullText,570,{fontSize:12}); |
Ok... getTextDimensions is part of cell.js Never touched that part of jsPDF. Probably you get the right height by calculating the length of the resulting array of splitTextToSize e.g. (7 lines) * fontSize (e.g. 12) * 1.25 * scaleFactor ... or maybe divided by scaleFactor... |
Thanks for your help @arasabbasi . Appericiate your efforts to opensource community |
Ok I checked the code of the method getTextDimensions. I strongly recommend not to use it. You should calculate it by the method i mentioned above. |
Ok, I refactored jsPDF.getTextDimensions in cell.js. It will be part of 1.4.2 See #1945 |
I'm currently using this solution
|
iam trying to add multipline text by using splittexttosize method but then when iam trying to retrieve its height iam getting wrong value which is too high?? what is the possible way to fix this and is there any way pass fontsize to gettextdimensions method? Thanks in advance
The text was updated successfully, but these errors were encountered: