Dear GroupDocs users, we’re pleased to announce GroupDocs.Comparison for Java 26.10. This release adds control over loading external resources referenced by documents, fixes the HTML report not being written on Java 9 and later and a temp-file failure on macOS, and improves PDF results — side-by-side comparison that follows content across page breaks, inline results without overlapping lines, faster rendering, table cells that keep their line breaks, and no more duplicated or interleaved characters. Three changes alter existing behaviour, so please review the section below before upgrading.
Behaviour changes to check before upgrading
- External resources referenced by a document are not loaded unless
LoadOptions.setSkipExternalResources(false)is set. new RevisionHandler(InputStream, FileType)now closes the stream when the handler is closed; passleaveOpen = trueto keep it.WordCompareOptions.isWordTrackChanges()now returnstruefor a new instance, following the default display modeREVISIONS.
Feature — control over loading external resources
A document can reference resources outside itself, such as an image given by a remote URL, and opening it used to make the comparison fetch that address. External resources are now skipped by default. LoadOptions.setSkipExternalResources(boolean) turns loading back on, and setWhitelistedResources(List<String>) names URL fragments that are still loaded while the rest are skipped.
LoadOptions loadOptions = new LoadOptions();
loadOptions.setSkipExternalResources(true);
loadOptions.setWhitelistedResources(Arrays.asList("includepicture-field.png"));
try (Comparer comparer = new Comparer("source.docx", loadOptions)) {
comparer.add("target.docx", loadOptions);
comparer.compare("result.docx");
}
For HTML documents, scripts, forms and navigation targets are never dereferenced during comparison, whatever these settings say. The settings apply to HTML, Word and presentation documents. (COMPARISONNET-4866, COMPARISONNET-4881)
Fix — HTML report not written for a .html result on Java 9 and later
Applying changes to a file named .html — for example after comparing JSON documents — wrote the compared text into it instead of the HTML report. The report is chosen from the output file name, and on Java 9 and later that name could not be read from the file stream. The library now keeps the path of every file it opens. Java 8 was not affected, and the detected changes were always correct; only what was saved differed. (COMPARISONJAVA-1667)
Fix — FileAlreadyExistsException when the temp directory is a symbolic link
On macOS /tmp is a symbolic link to /private/tmp. With java.io.tmpdir set to /tmp, creating a Comparer failed with FileAlreadyExistsException: /tmp : Can't create temp file!. A temp directory reached through a link is now used as it is. On earlier versions, point java.io.tmpdir at the real directory, for example -Djava.io.tmpdir=/private/tmp. (COMPARISONJAVA-1674)
Fix — faster PDF results without duplicated or interleaved characters
The PDF result was drawn one text segment at a time. On documents that store characters separately this slowed rendering down sharply, and it also misplaced characters, so words could appear twice or run into their neighbours — for example self self--explanatoryexplanatory instead of self-explanatory self-explanatory. Consecutive segments with the same formatting are now drawn together, which fixes both. Detected changes are unchanged. (COMPARISONNET-4892, COMPARISONNET-4893)
Fix — line breaks inside PDF table cells
Text in a PDF table cell was wrapped against the width of the page rather than the cell, so the cell’s own line breaks were merged and added text overflowed the cell. Cell paragraphs now keep their line breaks and wrap at the cell edge, including merged cells. (COMPARISONNET-2370)
Fix — side-by-side PDF comparison across page breaks
Side-by-side and interleaved results compared page N of the source with page N of the target, so when an edit pushed content onto the next page, everything that moved was reported deleted and re-inserted, often as letter-sized fragments. The two documents are now compared as a whole and each change is highlighted, by whole words, on the page where it is. Content that only moved to another page is no longer marked. (COMPARISONNET-4911)
Fix — inline PDF result drawing moved lines over other lines
An unchanged line that moved to another position — for example to the bottom of the next page after text was inserted above it — could be drawn where it used to be in the source, on top of another line. It now stays where it is in the target document. (COMPARISONNET-4896)
Fix — picture without image data
Comparing presentations or Word documents failed with a NullPointerException when a picture carried no image data. Such pictures are now compared without their image bytes. (COMPARISONNET-4883, COMPARISONNET-4887)
Update — RevisionHandler stream ownership
A RevisionHandler created from a file path never closed the file it opened; it now does. A new constructor, RevisionHandler(InputStream, FileType, boolean leaveOpen), states who owns a stream passed in. By default the handler now closes that stream, matching GroupDocs.Comparison for .NET; pass leaveOpen = true to keep it open. (COMPARISONNET-4773)
try (InputStream stream = Files.newInputStream(path);
RevisionHandler handler = new RevisionHandler(stream, FileType.DOCX, true)) {
List<RevisionInfo> revisions = handler.getRevisions();
}
Other updates
WordCompareOptions.isWordTrackChanges()is now derived from the display mode, as in .NET, so it can no longer contradict it. (COMPARISONJAVA)- File type detection no longer labels an unrecognised stream as EPUB just because it can be opened as one. EPUB is not a supported comparison format. (COMPARISONNET-4878)
- The published POM carries a short product description and declares
<organization>and<scm>. Metadata only. (COMPARISONJAVA-1774)
Resources