GroupDocs.Parser for Java 24.6 Release Notes
Full List of Issues Covering all Changes in this Release
Key | Summary | Category |
---|---|---|
PARSERNET-2306 | Implement the ability to customize recognition quality options of barcode scanning | Feature |
PARSERNET-2307 | Implement the ability to read damaged and distorted barcode | Feature |
PARSERJAVA-421 | Implement the ability to export the extracted data to XML format | Feature |
Public API and Backward Incompatible Changes
Ability to customize recognition quality options of barcode scanning
Description
This feature allows to customize the image and barcode quality to tune the barcode parsing speed and accuracy.
Public API changes
Parser public class was updated with changes as follows:
GetBarcodes(PageAreaOptions) and GetBarcodes(int, PageAreaOptions) methods were marked as deprecated;
Added GetBarcodes(BarcodeOptions) method;
Added GetBarcodes(int, BarcodeOptions) method.
PageBarcodeArea public class was updated with changes as follows:
PageBarcodeArea(string, string, Page, Rectangle) consturctor was marked as Obsolete;
Added PageBarcodeArea(string, string, int, double, Page, Rectangle) constructor;
Added Confidence property;
Added Angle property.
BarcodeOptions public class was added.
QualityMode public enum was added.
Usage
The following example shows how to extract barcodes with additional options from a document:
// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SamplePdfWithBarcodes))
{
// Check if the document supports barcodes extraction
if (!parser.getFeatures().isBarcodes())
{
System.out.println("Document doesn't support barcodes extraction.");
return;
}
// Create the options which are used for barcodes extraction
BarcodeOptions options = new BarcodeOptions(QualityMode.Low, QualityMode.Low, "QR");
// Extract barcodes from the document.
Iterable<PageBarcodeArea> barcodes = parser.getBarcodes(options);
// Iterate over barcodes
for (PageBarcodeArea barcode : barcodes)
{
// Print the page index
System.out.println("Page: " + String.valueOf(barcode.getPage().getIndex()));
// Print the barcode value
System.out.println("Value: " + barcode.getValue());
}
}
Ability to customize recognition quality options of barcode scanning
Description
This feature allows to read damaged and distorted barcodes.
Public API changes
No public API changes.
Usage
The following example shows how to extract corrupted barcodes from a document:
// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SampleCorruptedBarcodes)) {
// Check if the document supports barcodes extraction
if (!parser.getFeatures().isBarcodes()) {
System.out.println("Document doesn't support barcodes extraction.");
return;
}
// Create the options which are used for barcodes extraction
// The full constructor is used to set AllowIncorrectBarcodes property
BarcodeOptions options = new BarcodeOptions(
null,
QualityMode.Low,
QualityMode.Low,
null,
true,
"pdf417",
"QR");
// Extract barcodes from the document.
Iterable<PageBarcodeArea> barcodes = parser.getBarcodes(options);
// Iterate over barcodes
for (PageBarcodeArea barcode : barcodes) {
// Print the page index
System.out.println("Page: " + String.valueOf(barcode.getPage().getIndex()));
// Print the barcode value
System.out.println("Value: " + barcode.getValue());
// Print the confidence:
System.out.println("Confidence: " + String.valueOf(barcode.getConfidence()));
}
}
Implement the ability to export the extracted data to JSON and XML formats
Description
This feature allows to export data to JSON or XML files.
Public API changes
Added ExporterBase public class.
Added XmlExporter public class.
PageTableArea public class was updated with changes as follows:
- Added Cells property.
Usage
The following example shows how to extract barcodes from a document and export them to the XML file:
// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SamplePdfWithBarcodes))
{
// Check if the document supports barcodes extraction
if (!parser.getFeatures().isBarcodes())
{
System.out.println("Document doesn't support barcodes extraction.");
return;
}
// Create the options which are used for barcodes extraction
BarcodeOptions options = new BarcodeOptions(QualityMode.Low, QualityMode.Low, "QR");
// Extract barcodes from the document
Iterable<PageBarcodeArea> barcodes = parser.getBarcodes(options);
// Export data to "data.xml" file
XmlExporter exporter = new XmlExporter();
exporter.exportBarcodes(barcodes, "data.xml");
}