GroupDocs.Parser for .NET 19.12 Release Notes

Major Features

.NET Standard 2.0

Starting from 19.12 release GroupDocs.Parser for .NET includes .NET Standard 2.0 version.

There are the following features in this release:

  • Implement the ability to extract the image in a different format
  • Implement the ability to save images to file

Full List of Issues Covering all Changes in this Release

KeySummaryIssue Type
PARSERNET-1389Implement .NET Standard 2.0 supportNew feature
PARSERNET-1342Implement the ability to extract the image in a different formatNew feature
PARSERNET-1341Implement the ability to save images to fileNew feature

Public API and Backward Incompatible Changes

  1. Implement .NET Standard 2.0 support

    Description

    Starting from 19.12 release GroupDocs.Parser for .NET includes .NET Standard 2.0 version.

    Public API changes

    None

  2. Implement the ability to extract the image in a different format

    Description

    This feature allows to extract images to files.

    Public API changes

    • Added GetImageStream(ImageOptions) method to GroupDocs.Parser.Data.PageImageArea class

    Usage

    GetImageStream(ImageOptions) method is used to extract the image in a different format.

    ImageOptions class is used to define the image format into which the image is converted. The following image formats are supported:

    • Bmp
    • Gif
    • Jpeg
    • Png
    • WebP
    Example:
    // Create an instance of Parser class
    using (Parser parser = new Parser(Constants.SampleZip))
    {
        // 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)
        {
            using (Stream stream = image.GetImageStream(options))
            {
                // add a logic to work with the stream
            }
        }
    }
    
  3. Implement the ability to save images to file

    Description

    This feature allows to save images to files.

    Public API changes

    • Added Save methods to GroupDocs.Parser.Data.PageImageArea class

    Usage

    The following example shows how to extract images to files:

    // Create an instance of Parser class
    using (Parser parser = new Parser(Constants.SampleZip))
    {
        // 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);
        int imageNumber = 0;
        // Iterate over images
        foreach (PageImageArea image in images)
        {
            // Save the image to the png file
            image.Save(imageNumber.ToString() + ".png", options);
            imageNumber++;
        }
    }