GroupDocs.Parser for Java 26.10 Release Notes

Full list of changes in this release

IDSummaryCategory
PARSERJAVA-491Parser.search no longer throws NullPointerException when the search is not scoped to a pageFix
PARSERJAVA-513Parser.getStructure() works for Word documents with header or footer tables and returns well-formed XMLFix
PARSERJAVAParser.getFileInfo(String) reports password-protected DOCX, XLSX and PPTX files as encryptedFix
PARSERJAVAFileInfo.isEncrypted() is true only for encrypted PDF documentsFix
PARSERJAVAPDF image rectangles are measured from the top of the page, like the other page areasFix
PARSERJAVA-154Licensing is performed by GroupDocs.Foundation, the licensing core shared by the GroupDocs productsUpdate
PARSERJAVA-512Bundled Aspose components updatedUpdate
PARSERJAVA-509Published POM: product name, a short description, <url>, <organization> and <scm>Update

Behaviour changes to check before upgrading

Two changes alter what existing code observes. Each is described in its own section below.

  • The top coordinate of PDF image rectangles is measured from the top of the page.
  • In the structure XML of Word documents, words separated by a Word break character are separated by a space.

Fix — NullPointerException in search not scoped to a page

Every Parser.search call that was not scoped to a page threw since 25.5:

  • the search(String keyword) overload;
  • search(String keyword, SearchOptions options) with searchByPages set to false, which is the default;
  • searches that request highlights.
java.lang.NullPointerException
    at com.groupdocs.parser.FormatParserBase.getCachedText(...)

These calls return the search results again:

try (Parser parser = new Parser("sample.pdf")) {
    Iterable<SearchResult> results = parser.search("lorem");
    if (results == null) {
        return; // Search isn't supported for this document
    }

    for (SearchResult result : results) {
        System.out.println(result.getPosition() + ": " + result.getText());
    }
}

Scope.

  • Affects 25.5 to 26.9; searches with searchByPages set to true were not affected. (PARSERJAVA-491)

Fix — document structure of Word documents

Parser.getStructure() threw on word processing documents that contain a table in a header or footer, and could return XML that does not parse for documents with control characters in their text. Both are fixed:

  • tables in headers and footers are described by their logical grid: the row index in the table, the cell index in the row and spans of 1;
  • Word break characters (cell end, vertical tab, page break, column break) become a space, so the words they separate no longer run together;
  • characters that XML 1.0 does not allow are dropped;
  • attribute values are escaped the same way as text.

Scope.

  • Behaviour change: for documents with Word break characters the text in the structure XML differs from 26.9: the words around a break are separated by a space. (PARSERJAVA-513)

Fix — file information for password-protected documents

Parser.getFileInfo(String filePath) did not recognise password-protected DOCX, XLSX and PPTX files: it returned a size of 0 and isEncrypted() set to false for DOCX and XLSX, and no file type for PPTX. It now returns the same as the InputStream overload: the file size, isEncrypted() set to true and FileType.Unknown, because the format of an encrypted document cannot be read without the password.

FileInfo info = Parser.getFileInfo("protected.docx");
if (info.isEncrypted()) {
    LoadOptions options = new LoadOptions("password");
    try (Parser parser = new Parser("protected.docx", options);
         TextReader reader = parser.getText()) {
        System.out.println(reader.readToEnd());
    }
}

Scope.

  • Affects only the file path overload; getFileInfo(InputStream) was correct. (PARSERJAVA)

Fix — encryption of PDF documents

FileInfo.isEncrypted() returned true for every PDF document, whether it was encrypted or not. It is now true only for encrypted PDF documents. (PARSERJAVA)

Fix — position of PDF images

The rectangles of PDF images returned by Parser.getImages() were measured from the bottom of the page, while text, tables and the other page areas are measured from the top. Images are now measured from the top as well, so getImages(PageAreaOptions) finds the images inside the given rectangle.

try (Parser parser = new Parser("images.pdf")) {
    // Images in the top-left 400 x 400 points of each page
    PageAreaOptions options = new PageAreaOptions(new Rectangle(new Point(0, 0), new Size(400, 400)));
    for (PageImageArea image : parser.getImages(options)) {
        System.out.println(image.getPage().getIndex() + ": " + image.getRectangle());
    }
}

Scope.

  • Behaviour change: the top coordinate of PDF image rectangles differs from 26.9. Code that converted it from the bottom of the page itself must drop that conversion.
  • Affects PDF documents only. (PARSERJAVA)

Update — licensing on GroupDocs.Foundation

License validation, metered licensing and the licensing of the bundled Aspose components are performed by GroupDocs.Foundation, the same way as in the other GroupDocs products. The licensing API is unchanged: License.setLicense, Metered.setMeteredKey, Metered.getConsumptionQuantity and Metered.getConsumptionCredit are called exactly as before.

License license = new License();
license.setLicense("GroupDocs.Parser.Java.lic");

try (Parser parser = new Parser("document.docx");
     TextReader reader = parser.getText()) {
    System.out.println(reader.readToEnd());
}

Scope.

  • No code changes are needed. (PARSERJAVA-154)

Update — bundled Aspose components

Component26.926.10
Aspose.Cells26.326.9
Aspose.Email26.126.8
Aspose.PDF26.226.8.1
Aspose.Slides26.226.9
Aspose.Words26.326.8
Aspose.BarCode26.426.6
Aspose.Imaging25.1225.12
Aspose.ZIP25.1025.10
Aspose.Note23.323.3

The product still runs on Java 8. (PARSERJAVA-512)

Update — published artifact metadata

The published POM carries the name GroupDocs.Parser for Java, a short description of what the library extracts and which formats it reads, the product page as <url>, and declares <organization> and <scm>. This is what dependency indexes such as MVNRepository display. Metadata only — no code, behaviour or API changed. (PARSERJAVA-509)

Resources