Extract Images from PDF File

Using page resources

The following code snippet also works with Aspose.PDF.Drawing library.

Images are held in each page’s Resources collection’s Images collection. To extract a particular page, then get the image from the Images collection using the particular index of the image.

The image’s index returns an XImage object. This object provides a Save method for saving the extracted image. The following code snippet shows how to extract images from a PDF file.

Using ImagePlacementAbsorber

With the release of Aspose.PDF for .NET 7.0.0, we introduced classes called ImagePlacement, ImagePlacementAbsorber and ImagePlacementCollection which provide similar capability as the classes described above to get an image’s resolution and position in a PDF document.

  • ImagePlacementAbsorber performs image usage search as the ImagePlacement objects collection.
  • ImagePlacement provides the members Resolution and Rectangle that return actual image placement values.

The next code snippet also works with Aspose.Drawing library.