Iterate through the collection and get sizes, image types and image contents.
The following example shows how to extract images from a document page:
// Create an instance of Parser classusing(Parserparser=newParser(filePath)){// Check if the document supports images extractionif(!parser.Features.Images){Console.WriteLine("Document isn't supports images extraction.");return;}// Get the document infoIDocumentInfodocumentInfo=parser.GetDocumentInfo();// Check if the document has pagesif(documentInfo.PageCount==0){Console.WriteLine("Document hasn't pages.");return;}// Iterate over pagesfor(intpageIndex=0;pageIndex<documentInfo.PageCount;pageIndex++){// Print a page number Console.WriteLine(string.Format("Page {0}/{1}",pageIndex+1,documentInfo.PageCount));// Iterate over images// We ignore null-checking as we have checked images extraction feature support earlierforeach(PageImageAreaimageinparser.GetImages(pageIndex)){// Print a rectangle and image typeConsole.WriteLine(string.Format("R: {0}, Text: {1}",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: