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 images from a document:
// Create an instance of Parser classusing(Parserparser=newParser(filePath)){// Extract imagesIEnumerable<PageImageArea>images=parser.GetImages();// Check if image extraction is supportedif(images==null){Console.WriteLine("Image extraction isn't supported");return;}// Iterate over imagesforeach(PageImageAreaimageinimages){// Print page index and image typeConsole.WriteLine($"Page: {image.Page.Index + 1}, Type: {image.FileType}");}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: