ImagePlacement Class
Represents characteristics of an image placed to Pdf document page.
Inheritance Hierarchy

Namespace: Aspose.Pdf
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 20.6
public sealed class ImagePlacement

The ImagePlacement type exposes the following members.

Public propertyCompositingParameters
Gets compositing parameters of graphics state active for the image placed to the page.
Public propertyImage
Gets related XImage resource object.
Public propertyMatrix
Current transformation matrix for this image.
Public propertyPage
Gets the page containing the image.
Public propertyRectangle
Gets rectangle of the Image.
Public propertyResolution
Gets resolution of the Image.
Public propertyRotation
Gets rotation angle of the Image.
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodReplace
Replace image in collection with another image.
Public methodSave(Stream)
Saves image with corresponding transformations: scaling, rotation and resolution.
Public methodSave(Stream, ImageFormat)
Saves image with corresponding transformations: scaling, rotation and resolution.
Public methodToString (Inherited from Object.)
When an image is placed to a page it may have dimensions other than physical dimensions defined in Resources. The object ImagePlacement is intended to provide such information like dimensions, resolution and so on.
The example demonstrates how to find images on the first PDF document page and get images as bitmaps with visible dimensions.
// 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

// Retrieve images with visible dimensions
foreach (ImagePlacement imagePlacement in abs.ImagePlacements)
    Bitmap scaledImage;
    using (MemoryStream imageStream = new MemoryStream())
        // Retrieve image from resources
        imagePlacement.Image.Save(imageStream, ImageFormat.Png);
        Bitmap resourceImage = (Bitmap) Bitmap.FromStream(imageStream);
        // Create new bitmap with actual dimensions
        scaledImage = new Bitmap(resourceImage, (int)imagePlacement.Rectangle.Width, (int)imagePlacement.Rectangle.Height);
See Also