GroupDocs.Parser for .NET 22.2 Release Notes

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
PARSERNET-1874Implement the support of barcode extraction from imagesNew Feature
PARSERNET-1366Implement the ability to parse barcodes in the parse by template functionalityNew Feature
PARSERNET-1832Implement the ability to parse barcodes from documentsNew Feature
PARSERNET-1830Implement the ability to detect images by contentNew Feature
PARSERNET-1866Implement the ability to retrieve the general information about the password-protected fileNew Feature
PARSERNET-1822Improve text area extraction from WordProcessing documentsImprovement
PARSERNET-1823Improve text area extraction from spreadsheetsImprovement
PARSERNET-1868Improve the spreadsheet preview functionalityImprovement
PARSERNET-1880Implement the support for .NET 6Improvement
PARSERNET-1872.NET 6 supportImprovement

Public API and Backward Incompatible Changes

Implement the support of barcode extraction from images

Description

This feature provides the ability to extract barcodes from images.

Public API changes

No public API changes.

Usage

The following example shows how to extract barcodes from images:

// Create an instance of Parser class
using (Parser parser = new Parser(Constants.SampleImageWithBarcodes))
{
    // Check if the file supports barcodes extraction
    if (!parser.Features.Barcodes)
    {
        Console.WriteLine("File doesn't support barcodes extraction.");
        return;
    }

    // Extract barcodes from the image.
    IEnumerable<PageBarcodeArea> barcodes = parser.GetBarcodes();

    // Iterate over barcodes
    foreach (PageBarcodeArea barcode in barcodes)
    {
        // Print the page index
        Console.WriteLine("Page: " + barcode.Page.Index.ToString());
        // Print the barcode value
        Console.WriteLine("Value: " + barcode.Value);
    }
}

Implement the ability to parse barcodes in the parse by template functionality

Description

This feature provides the ability to extract barcodes from documents.

Public API changes

GroupDocs.Parser.Options.Features public class was updated with changes as follows:

PageBarcodeArea public class was added

Parser public class was updated with changes as follows:

Usage

The following example shows how to extract barcodes from a document:

// Create an instance of Parser class
using (Parser parser = new Parser(Constants.SamplePdfWithBarcodes))
{
    // Check if the document supports barcodes extraction
    if (!parser.Features.Barcodes)
    {
        Console.WriteLine("Document doesn't support barcodes extraction.");
        return;
    }

    // Extract barcodes from the document.
    IEnumerable<PageBarcodeArea> barcodes = parser.GetBarcodes();

    // Iterate over barcodes
    foreach (PageBarcodeArea barcode in barcodes)
    {
        // Print the page index
        Console.WriteLine("Page: " + barcode.Page.Index.ToString());
        // Print the barcode value
        Console.WriteLine("Value: " + barcode.Value);
    }
}

Implement the ability to detect images by content

Description

This feature allows to extract images from email attachments or zip archives in the case when file extension isn’t set.

Public API changes

No public API changes.

Usage

The following example shows how to extract all images from the whole document:

// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
    // Extract images
    IEnumerable<PageImageArea> images = parser.GetImages();
    // Check if images extraction is supported
    if (images == null)
    {
        Console.WriteLine("Images extraction isn't supported");
        return;
    }
    // Iterate over images
    foreach (PageImageArea image in images)
    {
        // Print a page index, rectangle and image type:
        Console.WriteLine(string.Format("Page: {0}, R: {1}, Type: {2}", image.Page.Index, image.Rectangle, image.FileType));
    }
}

Implement the ability to parse barcodes from documents

Description

This feature allows to define barcode fields in templates.

Public API changes

TemplateBarcode public class was added.

Usage

The following example shows how to define a template barcode field:

// Define a barcode field
TemplateBarcode barcode = new TemplateBarcode(
    new Rectangle(new Point(590, 80), new Size(150, 150)),
    "QR");

// Create a template
Template template = new Template(new TemplateItem[] { barcode });

// Create an instance of Parser class
using (Parser parser = new Parser(Constants.SamplePdfWithBarcodes))
{
    // Parse the document by the template
    DocumentData data = parser.ParseByTemplate(template);

    // Print all extracted data
    for (int i = 0; i < data.Count; i++)
    {
        Console.Write(data[i].Name + ": ");
        PageBarcodeArea area = data[i].PageArea as PageBarcodeArea;
        Console.WriteLine(area == null ? "Not a template barcode field" : area.Value);
    }
}

Implement the ability to retrieve the general information about the password-protected file

Description

This feature allows to detect the file type of the password-protected OOXML documents.

Public API changes

Parser public class was updated with changes as follows:

Usage

The following code shows how to check a file type of the password-protected document:

// Get a file info
Options.FileInfo info = Parser.GetFileInfo(filePath, new LoadOptions("password"));
// Check IsEncrypted property
Console.WriteLine(info.IsEncrypted ? "Password is required" : "");
// Print the file type
Console.WriteLine(info.FileType.ToString());