With all the various methods you have in adding text to a page i do not see any built in mechanism to detect if the string applied to the relevant Rectangle is over flowing the bounds. So, if im an adding text to a part of a PDF that has specific boundaries i need to know if it overflows and iterate over font-size etc to make the text fit. I have done this in the past with DynamicPDF as they have an overflow flag, so i just presumed Aspose would have this too… If you do, i cannot seem to find it. If not could you point me to samples where this functionality is achieved?? I. am a fully paid up User of Aspose/Conholdate. Any help much appreciated
We have understood your concerns and will definitely look into it. Can you please also share a sample code snippet to show the approach that you are using specifically to add the text inside PDF? We will log an investigation ticket in our issue tracking system and share the ID with you.
I don’t really have code as I’m just investigating and will hand off to a dev at some stage… but I don’t want to hear back from them that it can’t be done
So here is some pseudo code that reflects what I’m trying to achieve… a bit blunt, but should give you an impression of what I’m trying to do
Create an instance of Document
Add a page to the Document
Set the size of the page
Add 2 images to the page
Add 3 blocks of text to the page
For each block of text:
Check if it fits on the page using the TextFragment’s IsOverflow method
If it doesn’t fit:
Reduce font size
If font size can’t be reduced:
If kerning can’t be reduced:
Reduce horizontal scale
If horizontal scale can’t be reduced:
Add the text to the page
Save the Document as a PDF file
We are checking it and will get back to you shortly.
Don’t spend time in the algorithm of what to do when there is overflow…
Just a mechanism to detect it !
PDF is a complex format and text in it does not get added in paragraphs that go with flow. Nevertheless, we need to look into this matter further. We will be logging an investigation ticket and sharing the ID with you shortly.
Ok, thanks for your help… as I said, I have done this before when I use
We’d to use DynamicPDF… just as an fyi
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-53628
You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thanks for looking into this Asad. If this becomes an urgent issue for me I will look into the paid support option.
What I take from this is that there is direct overflow method at the moment.
What I haven’t looked into is line counts in text fragments or paragraphs etc… perhaps there is some rudimentary calculations I can apply.
Thanks for your help
You can please keep exploring the API features meanwhile. In case you find any missing feature or issues, please feel free to let us know.