GroupDocs.Parser for .NET 24.12 Release Notes

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
PARSERNET-2565Improve the page preview generation for the barcode extraction and OCRImprovement

Public API and Backward Incompatible Changes

Improve the page preview generation for the barcode extraction and OCR

Description

This improvement adds the ability to customize the page preview generation for the barcode extraction and OCR.

Public API changes

ParserSettings public class was updated with changes as follows:

PagePreviewOptions public class was updated with changes as follows:

PagePreviewFormat public enumeration was updated with changes as follows:

  • Added Auto field.

Usage

The following example shows how to customize the page preview generation for the barcode extraction:

// Create an instance of the page preview generation options with 3x scale factor
// Scale factor is used for those documents which contain small fonts (for OCR) or barcodes for better recognition
PagePreviewOptions pagePreviewOptions = new PagePreviewOptions(PagePreviewOptions.DEFAULT_DPI * 3);

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

    // Scan barcodes from the file.
    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);
    }
}