Dear Support,
I’m trying to import a TIFF image into a PDF file. I have found two tutorials here and here, but neither of them works. It seems like VerticalAlignment.Middle does not exist, and the image object does not have the setRectangle method. Were there any changes in image placement since Aspose.PDF version 21.9? I’m currently using version 24.6 with Aspose.Total license.
private void importImage() {
try (com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(*path to pdf*)) {
com.aspose.pdf.Page page = pdfDocument.getPages().get_Item(1);
com.aspose.pdf.Image image = new com.aspose.pdf.Image();
image.setFile(*path to tiff*);
// Code from the second tutorial
image.setHorizontalAlignment(HorizontalAlignment.Center);
image.setVerticalAlignment(VerticalAlignment.Middle);
image.setRectangle(new Rectangle(100, 100, 200, 200));
page.getParagraphs().add(image);
pdfDocument.save(*output path*);
System.out.println("TIFF image successfully added to the PDF.");
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error occurred while processing!");
}
}
I would appreciate any information regarding this issue.
Thank you in advance!