Search and replace images

Hi,

I am looking to search and replace images inside a pdf. The PdfExtractor can pull out all the images, however, is there a way to loop thru all the images, pull out its meta-tag, and replace it with the corresponding image?

John

Hi,

Thank you for considering Aspose. This feature is not support now and we have no plan to support it in short time.

Regards.

@dablackgoku1234

We have added new property ImagePlacementAbsorber in Aspose.PDF 18.8 to replace images. Following example serve the purpose. Please check and share feedback with us.

Document doc = new Document(@“D:\Tests\input.pdf”);

// Create ImagePlacementAbsorber object to perform image placement search
ImagePlacementAbsorber abs = new ImagePlacementAbsorber();

// Accept the absorber for first page
doc.Pages[1].Accept(abs);

// Display image placement properties for all placements
foreach (ImagePlacement imagePlacement in abs.ImagePlacements)
{
Console.Out.WriteLine(“image width:” + imagePlacement.Rectangle.Width);
Console.Out.WriteLine(“image height:” + imagePlacement.Rectangle.Height);
Console.Out.WriteLine(“image LLX:” + imagePlacement.Rectangle.LLX);
Console.Out.WriteLine(“image LLY:” + imagePlacement.Rectangle.LLY);
Console.Out.WriteLine(“image horizontal resolution:” + imagePlacement.Resolution.X);
Console.Out.WriteLine(“image vertical resolution:” + imagePlacement.Resolution.Y);
}