Free Support Forum -

Image position on the page


how to get the exact coordinates of image on the page?

Hi tomasz,

Thanks for your inquiry. Please check following code snippet to get image coordinates. Hopefully it will help you to accomplish your requirements.

// Open

Document doc = new Document(myDir+"input.pdf");

// Create ImagePlacementAbsorber object to perform image placement search

ImagePlacementAbsorber abs = new ImagePlacementAbsorber();

// Accept the absorber for first page


// Display image placement properties for all placements

for (com.aspose.pdf.ImagePlacement imagePlacement : (Iterable)abs.getImagePlacements())


System.out.println("image width:" + imagePlacement.getRectangle().getWidth());

System.out.println("image height:" + imagePlacement.getRectangle().getHeight());

System.out.println("image LLX:" + imagePlacement.getRectangle().getLLX());

System.out.println("image LLY:" + imagePlacement.getRectangle().getLLY());

System.out.println("image horizontal resolution:" + imagePlacement.getResolution().getX());

System.out.println("image vertical resolution:" + imagePlacement.getResolution().getX());


Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal

I am getting error saying Aspose.Pdf.Document does not contain a defination for getPages and no extension method getPages accepting a first argument of type Aspose.Pdf.Document could be found.

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(inFile);
Aspose.Pdf.ImagePlacementAbsorber abs = new Aspose.Pdf.ImagePlacementAbsorber();

Help me on this. Thanks in advance.


Thanks for your inquiry.

By looking at the code snippet, that you have shared, it seems that you are using .NET library and trying to access the method with different syntax i.e. Java. Would you please confirm the API, which you are using in your environment. Just in case of .NET library, please use following code snippet:


Thanks for the information :+1: