Partial visibility of text inserted using insert_htmlbox() #4275
Unanswered
Mahendranath94
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @JorjMcKie, Is there any solution for this issue? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to insert some text in a bounding box, as I don't know the font size of text to be inserted, I am giving it a larger number taking advantage of insert_htmlbox() as the content will automatically be scaled down to fit in the bounding box. But I noticed that there are some cases where it isn't inserting everything in the given bbox, on selection of text, I can notice that it inserted everything, but only partial text is inside the box and rest is outside the box and not visible. Also, this is happening mostly for the text containing only single word.
Here for this sample code, as I know the font size of text, I gave 7. Now, as I am using insert_htmlbox() it should dynamically fit the text by reducing the font size if the given bbox, but if we look at the output complete text is not inserted in bbox, on selection of text I can notice that it inserted everything, but only partial text is inside the box and rest is outside the box and not visible.
Text : PyMuPDF, size: 7
Now I tried to give some bigger font size (i.e 20) as I also have some texts without font size. Now I also i can see only partial text is inserted in the bbox and only text inside bbox is visible. How to insert everything inside the given bbox with insert_htmlbox().
Text : PyMuPDF, size: 20
I have seen such issues happen mostly for the text with one word, but there are also some cases where it happens even for text with more that 1 word (I made text to "Hello PyMuPDF " so that the number of words now will be 2, when split on space)
Text : Hello PyMuPDF, size: 7
The bounding box for all three 3 cases is same. So, now how to fit the given text in bbox by dynamically adjusting the font size using insert_htmlbox so that we can see whole text in bbox?
Beta Was this translation helpful? Give feedback.
All reactions