GroupDocs.Parser for .NET 23.10 Release Notes
Full List of Issues Covering all Changes in this Release
Key | Summary | Category |
---|---|---|
PARSERNET-2151 | Improve template fields parsing functionality | Improvement |
PARSERNET-2150 | Implement the ability to set CASE of template fields | Feature |
Public API and Backward Incompatible Changes
Improve template fields parsing functionality
Description
This features allows to set the size of the border that is ignored when captured by the rectangular area.
Public API changes
PageAreaOptions public class was updated with changes as follows:
- Added PageAreaOptions(Rectangle, double) constructor.
- Added RectangleTolerance property.
PageTextAreaOptions public class was updated with changes as follows:
- Added PageTextAreaOptions(string, Rectangle, double) constructor.
- Added PageTextAreaOptions(string, bool, bool, bool, Rectangle, double) constructor.
TemplateOptions public class was added.
Template public class was updated with changes as follows:
Usage
The following example shows how to set the size of the border that is ignored when captured by the rectangular area:
// Define a barcode field
TemplateBarcode barcode = new TemplateBarcode(
new Rectangle(new Point(405, 55), new Size(100, 50)),
"QR");
// Create a template with the size of the border with 50% of the item height
Template template = new Template(new TemplateItem[] { barcode }, new TemplateOptions(0.5));
// Create an instance of Parser class
using (Parser parser = new Parser(Constants.SamplePdfWithBarcodes))
{
// Iterate over document pages
foreach (DocumentPageData data in parser.ParsePagesByTemplate(template))
{
// Print the page index
Console.WriteLine("Page: " + data.PageIndex);
// 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);
}
}
}
Improve template fields parsing functionality
Description
This improvement allows to set the case of the field name.
Public API changes
TemplateBarcode public class was updated with changes as follows:
- Added TemplateBarcode(Rectangle, string, int?, bool) constructor.
TemplateField public class was updated with changes as follows:
- Added TemplateField(TemplatePosition, string, int?, bool) constructor.
TemplateTable public class was updated with changes as follows:
- Added TemplateTable(TemplateTableLayout, string, int?, bool) constructor.
- Added TemplateTable(TemplateTableParameters, string, int?, bool) constructor.
Usage
The following example shows how to create an instance of template item without name case converting:
// Create an instance of barcode field
TemplateBarcode barcode = new TemplateBarcode(rectangle, "FieldName", 1, false);
// Create an instance of text field
TemplateField field = new TemplateField(position, "FieldName", 1, false);
// Create an instance of table field with layout
TemplateTable table = new TemplateTable(layout, "TableName", null, false);
// Create an instance of table field with table parameters
TemplateTable table = new TemplateTable(parameters, "TableName", 1, false);