The following example shows how to save images to files:
// Create an instance of Parser classusing(Parserparser=newParser(filePath)){// 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;}// Iterate over imagesforeach(PageImageAreaimageinimages){// Save the image to the fileimage.Save(Guid.NewGuid().ToString()+image.FileType.Extension);}}
The following example shows how to save images to files in a different format:
// Create an instance of Parser classusing(Parserparser=newParser(filePath)){// 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);// Iterate over imagesforeach(PageImageAreaimageinimages){// Save the image to the png fileimage.Save(Guid.NewGuid().ToString()+".png",options);}}