Save
Contents
 [
        
            Hide
        ]
    Save(string)
Saves the image to the file.
public void Save(string filePath)
| Parameter | Type | Description | 
|---|---|---|
| filePath | String | The path to the file. | 
Examples
The following example shows how to save images to files:
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
    // Extract images from document
    IEnumerable<PageImageArea> images = parser.GetImages();
    
    // Check if images extraction is supported
    if (images == null)
    {
        Console.WriteLine("Page images extraction isn't supported");
        return;
    }
    // Iterate over images
    foreach (PageImageArea image in images)
    {
        // Save the image to the file
        image.Save(Guid.NewGuid().ToString() + image.FileType.Extension);
    }
}
See Also
- class PageImageArea
- namespace GroupDocs.Parser.Data
- assembly GroupDocs.Parser
Save(string, ImageOptions)
Saves the image to the file in a different format.
public void Save(string filePath, ImageOptions options)
| Parameter | Type | Description | 
|---|---|---|
| filePath | String | The path to the file. | 
| options | ImageOptions | The options which are used to save the image. | 
Examples
The following example shows how to save images to files in a different format:
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
    // Extract images from document
    IEnumerable<PageImageArea> images = parser.GetImages();
    
    // Check if images extraction is supported
    if (images == null)
    {
        Console.WriteLine("Page images extraction isn't supported");
        return;
    }
    // Create the options to save images in PNG format
    ImageOptions options = new ImageOptions(ImageFormat.Png);
    
    // Iterate over images
    foreach (PageImageArea image in images)
    {
        // Save the image to the png file
        image.Save(Guid.NewGuid().ToString() + ".png", options);
    }
}
See Also
- class ImageOptions
- class PageImageArea
- namespace GroupDocs.Parser.Data
- assembly GroupDocs.Parser