Matching an image to its placement

Hello,


I’m trying to match an image in a page of a PDF file (in Page.Resources.Images) with its placement (using an ImagePlacementAbsorber).
I’m using Aspose PDF 8.1

Using the ImagePlacementAbsorber I can get the position of each image in a particular page and it also has a reference to an XImage object.
The problem is that I can’t map that XImage object to the one in Page.Resources.Images because I don’t know it’s name or index.
The XImage object that’s in the ImagePlacement object always has its name set to “X”.

How can I find the image at Page.Resources.Images that matches a particular ImagePlacement instance?

Regards,
Diego.

Hi Diego,


Thanks for your inquiry. After initial investigation, I’ve logged a ticket as PDFNEWNET-35499 in our issue tracking system for further investigation and resolution. We will keep you updated regarding issue progress via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

Hi Tilal,


Apologies for the delay.
Attached you will find a document that describes the issue. It’s a one-page PDF document with three images that was saved from Microsoft Word 2010 (using Save As action)

This is some sample code I used to describe the problem.

Document doc = new Document(“path_to_file”);
ImagePlacementAbsorber absorber = new ImagePlacementAbsorber();
Page page1 = doc.Pages[1];
page1.Accept(absorber);
for (int i = absorber.ImagePlacements.Count; i > 0; i–){
ImagePlacement imgPlc = absorber.ImagePlacements[i];
Console.WriteLine("Placement Image Name: " + (imgPlc.Image.Name??“null”));
}
XImageCollection pageImages = page1.Resources.Images;
var enumerator = pageImages.GetEnumerator();
while (enumerator.MoveNext())
{
XImage img = (XImage)enumerator.Current;
Console.WriteLine("Resource Image Name: " + (img.Name??"null);
}

Note that in both the XImage object in the page resource’s and the one in the ImagePlacement the “Name” is always null.
This is the output from the code above:
Placement Image Name: null
Placement Image Name: null
Placement Image Name: null
Resource Image Name: null
Resource Image Name: null
Resource Image Name: null

Thanks,
Diego.

Hi Diego,


Thanks for providing additional information. I’ve shared the details with development team, hopefully it will help in investigation and resolution of the issue. We will keep you updated about issue progress via this forum thread.

Thanks for your patience and cooperation.

Best Regards,