Extract Images from PDF

Extract Images from PDF in C#

GroupDocs.Parser (which is a part of Conholdate.Total for .NET) is very powerful tool to extract images from PDF of other various kind of documents and it can be easily used in simple use cases.

This article shows how to write code for a simplest scenario.

To extract images from documents simply call GetImages method:

IEnumerable<PageImageArea> GetImages();

The methods return a collection of PageImageArea objects:

Member Description
Page The page that contains the text area.
Rectangle The rectangular area on the page that contains the text area.
FileType The format of the image.
Rotation The rotation angle of the image.
Stream GetImageStream() Returns the image stream.
Stream GetImageStream(ImageOptions) Returns the image stream in a different format.
void Save(String) Saves the image to the file.
void Save(String, ImageOptions) Saves the image to the file in a different format.

The following code snippet demonstrates how to extract all images from the whole document: