Check if collection isn’t null (images extraction is supported for the document);
Iterate through the collection and save image contents to the file.
The following example shows how to save images to files:
// Create an instance of Parser classusing(Parserparser=newParser(Constants.SampleZip)){// Extract images from documentIEnumerable<PageImageArea>images=parser.GetImages();// Check if images extraction is supportedif(images==null){Console.WriteLine("Page images extraction isn't supported");return;}// Create the options to save images in PNG formatImageOptionsoptions=newImageOptions(ImageFormat.Png);intimageNumber=0;// Iterate over imagesforeach(PageImageAreaimageinimages){// Save the image to the png fileimage.Save(imageNumber.ToString()+".png",options);imageNumber++;}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: