GroupDocs.Parser for .NET 24.12 Release Notes
This page contains release notes for GroupDocs.Parser for .NET 24.12
Full List of Issues Covering all Changes in this Release
Key | Summary | Category |
---|---|---|
PARSERNET-2565 | Improve the page preview generation for the barcode extraction and OCR | Improvement |
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:
- Added ParserSettings(PagePreviewOptions) constuctor.
- Added ParserSettings(ILogger logger, PagePreviewOptions) constuctor.
- Added ParserSettings(OcrConnectorBase, PagePreviewOptions) constuctor.
- Added ParserSettings(ILogger, OcrConnectorBase, PagePreviewOptions) constuctor.
- Added ParserSettings(ILogger, OcrConnectorBase, ExternalResourceHandler, PagePreviewOptions) constuctor.
- Added PagePreviewOptions property.
PagePreviewOptions public class was updated with changes as follows:
- Added PagePreviewOptions() constuctor.
- Added ScaleFactor property.
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);
}
}