Hello Aspose!
Could you please help me with finding out height of content on the page?
My task is add TextStamp on each stamp. In the same time stamp should not overlap content.
- First option to do it is calculate stamp size and shrink initial contents size via PdfFileEditor.resizeContents().
User of my system can set text any length, any font and any font size. As consequence height of stamp could be any. So I have to calculate stamp height before rendering new PDF. How to do it I don’t know.
textStamp.getHeight() / textStamp.getTextState().getTextHeight() will return font size of one line, independent of stamp's width, independent of text legth.
- Second option is to restrict user to use only one line. But font size anyway can be any.
So I have to get Content height to understand which top / bottom margins already exist on page and how many margin point I have to add.
page.getPageInfo().getMargin().getTop() - doesn’t help because it says margin is 70 while in real life it is 0.
Example of PDF in attachment.
Thank you in advance!
Best wishes,
Artem Fokin
SamplePDF.pdf (556.7 KB)