Check if collection isn’t null (images extraction is supported for the document);
Iterate through the collection and get sizes, image types and image contents.
The following example shows how to extract only images from the upper-left corner:
// Create an instance of Parser classusing(Parserparser=newParser(filePath)){// Create the options which are used for images extractionPageAreaOptionsoptions=newPageAreaOptions(newRectangle(newPoint(0,0),newSize(300,100)));// Extract images from the upper-left corner of a page:IEnumerable<PageImageArea>images=parser.GetImages(options);// Check if images extraction is supportedif(images==null){Console.WriteLine("Page images extraction isn't supported");return;}// Iterate over imagesforeach(PageImageAreaimageinimages){// Print a page index, rectangle and image type:Console.WriteLine(string.Format("Page: {0}, R: {1}, Type: {2}",image.Page.Index,image.Rectangle,image.FileType));}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: