ImagePlacementAbsorber

ImagePlacementAbsorber class

Represents an absorber object of image placement objects. Performs search of image usages and provides access to search results via ImagePlacements collection.

public sealed class ImagePlacementAbsorber

Constructors

Name Description
ImagePlacementAbsorber() The default constructor.

Properties

Name Description
ImagePlacements { get; } Gets collection of image placement occurrences that are presented with ImagePlacement objects.
IsReadOnlyMode { get; set; } Gets/sets read only mode for parsing operations collection. It may help against out of memory exceptions.

Methods

Name Description
Visit(Document) Performs search on the specified document.
Visit(Page) Performs search on the specified page.

Remarks

The ImagePlacementAbsorber object is basically used in images search scenario. When the search is completed the occurrences are represented with ImagePlacement objects that the ImagePlacements collection contains. The ImagePlacement object provides access to the image placement properties: dimensions, resolution etc.

Examples

The example demonstrates how to find images on the first PDF document page and get the image placement properties.

// Open document
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);
}

See Also