GroupDocs.Parser for Java 23.9 Release Notes
This page contains release notes for GroupDocs.Parser for Java 23.9
Full List of Issues Covering all Changes in this Release
Key | Summary | Category |
---|---|---|
PARSERNET-1963 | Implement the ability to return parsing by template result as Iterable object | Feature |
PARSERNET-2083 | Distinguish inline images in email | Feature |
Public API and Backward Incompatible Changes
Distinguish inline images in email
Description
This feature allows to distinguish inline images and other attachments in emails.
Public API changes
string getMetadataValue method was added in ContainerItem class.
Usage
The following example shows how to detect inline attachments:
// Create an instance of Parser class
try (Parser parser = new Parser(Constants.InlineImages)) {
// Extract attachments from the container
Iterable<ContainerItem> attachments = parser.getContainer();
// Check if container extraction is supported
if (attachments == null) {
System.out.println("Container extraction isn't supported");
}
// Iterate over attachments
for (ContainerItem item : attachments) {
// Check metadata for 'disposition' item
if (item.getMetadataValue("disposition") == "inline") {
// If it's 'inline' then print an item name
System.out.println(String.format("%s", item.getName()));
}
}
}
Implement the ability to return parsing by template result as Iterable object
Description
This features allows to parse a document by pages instead of the whole document at once.
Public API changes
DocumentPageData public class was added.
Parser public class was updated with changes as follows:
- Added parsePagesByTemplate method.
Usage
The following example shows how to parse document pages by template:
// Define a barcode field
TemplateBarcode barcode = new TemplateBarcode(
new Rectangle(new Point(405, 55), new Size(100, 50)),
"QR");
// Create a template
Template template = new Template(Arrays.asList(new TemplateItem[]{barcode}));
// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SamplePdfWithBarcodes)) {
// Iterate over document pages
for (DocumentPageData data : parser.parsePagesByTemplate(template)) {
System.out.println(String.format("Page: %s", data.getPageIndex()));
// Print all extracted data
for (int i = 0; i < data.getCount(); i++) {
// Print field name
System.out.print(data.get(i).getName() + ": ");
// As we have defined only barcode fields in the template,
// we cast PageArea property value to PageBarcodeArea
PageBarcodeArea area = data.get(i).getPageArea() instanceof PageBarcodeArea
? (PageBarcodeArea) data.get(i).getPageArea()
: null;
System.out.println(area == null ? "Not a template barcode field" : area.getValue());
}
}
}