Hi,
When we try to align 2 images on one line, one to the left and one to the right, the results are not what we expected:
Document document = new Document();
File generated = File.createTempFile("generated", ".pdf");
Page page = document.getPages().add();
page.getPageInfo().setMargin(new MarginInfo(50,50,50,50));
FloatingBox box = new FloatingBox((float) (page.getPageInfo().getWidth() - 100), 200);
box.setPadding(new MarginInfo(30,30,30,30));
box.setTop(10);
box.setLeft(10);
box.setBackgroundColor(Color.getBlue());
Image image = new Image();
image.setHorizontalAlignment(HorizontalAlignment.Left);
image.setInLineParagraph(true);
image.setFixHeight(140);
image.setFixWidth(100);
image.setFile("/home/ahashem/Downloads/bananas.png");
Image image2 = new Image();
image2.setHorizontalAlignment(HorizontalAlignment.Right);
image2.setInLineParagraph(true);
image2.setFixHeight(140);
image2.setFixWidth(100);
image2.setFile("/home/ahashem/Downloads/bananas.png");
box.getParagraphs().add(image);
box.getParagraphs().add(image2);
page.getParagraphs().add(box);
document.save(generated.getAbsolutePath());
Sample output:
generated6631338179035582061.pdf (72.9 KB)
Sample image we used:
bananas.png (2.1 KB)
Aspose version: 21.12