I am using PDF Java library with version 23.9. I am trying to insert a .jpg file in the middle of a paragraph. Take the following as an example:
Document doc = new Document();
Page page = doc.getPages().add();
TextFragment text = new TextFragment("Hello World.. ");
page.getParagraphs().add(text);
Image image = new Image();
image.setInLineParagraph (true);
image.setFile("aaa.jpg");
image.setFixHeight(135);
image.setFixWidth(225);
page.getParagraphs().add(image);
text = new TextFragment(" Hello Again..Hello Again..Hello Again..Hello
Again..Hello Again..Hello Again..Hello Again..Hello Again..");
text.setInLineParagraph (true);
page.getParagraphs().add(text);
doc.save("test.pdf") ;
doc.close() ;
The image is inserted after the first text and the second text after the image is long. When the second text wraps to next line, it will show on top of the image instead of wrapping around the image or showing underneath the image. I am wondering whether there is a way to not letting the text show on top of the image?
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): PDFJAVA-43435
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.
Aspose does not support inserting an image in the middle of a paragraph with text.
Also, please note that Adobe Acrobat does not allow you to insert a picture so that the text wraps around the picture.
If the you want to create a page where the text wraps the image, one of the options is to use a table without borders. Please, see next code snippet: