0

I am using Itext pdf java library to generate pdf document.

Need to add an image to pdf page after some text snippet. As per current design, the first text will be added to pdf and later on based on the PdfPageEventHelper images will be added.

Now the problem is text snippet can be of any length. So while adding the image I need to provide x and y coordinates. How can I calculate that based on the length of text snippet on that page so that text and image don't overlap?

rimonmostafiz
  • 1,341
  • 1
  • 15
  • 33
  • Do you call `newPage()` after adding the text for the page? If so, your current design should be changed to allow for a trivial solution. (Please add the pivotal code structure, currently one has to guess to much...) – mkl Dec 21 '17 at 13:19
  • Please take a look at the example in this question: https://stackoverflow.com/questions/47895935 What you are asking for is very easy to achieve if you create your content in HTML and use the CSS `float: right` for the image. – Bruno Lowagie Dec 21 '17 at 16:30

0 Answers0