How to insert image into a paragraph?

Hi,

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?

@stata

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.

@stata

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:

Document doc = new Document();
Page page = doc.getPages().add();

TextFragment text1 = new TextFragment("Hello World.. ");

Image image = new Image();
image.setInLineParagraph(true);
image.setFile(dataDir + "aspose.png");
image.setFixHeight(135);
image.setFixWidth(225);

TextFragment text2 = new TextFragment(" Hello Again..Hello Again..Hello Again..Hello Again..Hello Again..Hello Again..Hello Again..Hello Again..");

Table table = new Table();
table.setColumnWidths("60 " + image.getFixWidth() + " 130");
page.getParagraphs().add(table);
Row r = table.getRows().add();

Cell leftTextCell = r.getCells().add();
leftTextCell.setVerticalAlignment(VerticalAlignment.Top);
leftTextCell.getParagraphs().add(text1);

Cell imageCell = r.getCells().add();
imageCell.setVerticalAlignment(VerticalAlignment.Top);
imageCell.getParagraphs().add(image);

Cell rightTextCell = r.getCells().add();
rightTextCell.setVerticalAlignment(VerticalAlignment.Top);
rightTextCell.getParagraphs().add(text2);

doc.save(dataDir + "output_3_" + BuildVersionInfo.ASSEMBLY_VERSION + ".pdf");
doc.close();