[Release] GroupDocs.Comparison for Java 26.8

Dear GroupDocs users, we’re pleased to announce GroupDocs.Comparison for Java 26.8. This release adds a side-by-side comparison view for PDF documents, lets you restrict PDF comparison to a page range, reports the row, column and column header of every change in spreadsheet comparison, and rewrites how paragraphs and tables are laid out in PDF results. The public API is backward compatible — existing code continues to work unchanged, and all new options are opt-in. Result documents produced for PDF, text/JSON and CSV do look different from previous versions; see Scope in each section below.

Feature — side-by-side comparison view for PDF

PDF-specific options now live in a dedicated PdfCompareOptions class, which extends CompareOptions. Its DisplayMode controls how the result document is laid out, so heavily differing documents no longer overlap their content on a single page.

import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.options.PdfCompareOptions;
import com.groupdocs.comparison.options.save.SaveOptions;

try (Comparer comparer = new Comparer(sourcePath)) {
    comparer.add(targetPath);

    PdfCompareOptions options = new PdfCompareOptions();
    options.setDisplayMode(PdfCompareOptions.ComparisonDisplayMode.SIDE_BY_SIDE);
    options.setAnnotationAuthorName("Reviewer");

    comparer.compare(resultPath, options);
}

Three modes are available.

  • INLINE — the default and the previous behaviour: one merged document where deletions and insertions are highlighted on the same pages.
  • SIDE_BY_SIDE — each result page shows the source page next to its matching target page; deletions appear on the left, insertions on the right. Content from the two documents never overlaps.
  • INTERLEAVED — alternating pages: odd pages come from the source and even pages from the target. Open the result with “Two Page View” enabled to see each pair together.

Scope.

  • Pages are aligned before comparison. When the two documents have a different number of pages, blank pages are inserted at the positions found by aligning pages on their text content, so matching pages stay opposite each other.
  • In the two non-inline modes text is compared by the Aspose side-by-side comparer, so getChanges(...) returns an empty array. Images, annotations and watermarks are still compared and marked with rectangle border annotations, coloured from DeletedItemStyle, InsertedItemStyle and ChangedItemStyle.
  • PdfCompareOptions also carries CompareImagesPdf, ImagesInheritanceMode and the new AnnotationAuthorName. The first two remain available on CompareOptions but are now deprecated in favour of the PDF-specific class; nothing is removed and existing calls keep working. (COMPARISONNET-4726, COMPARISONNET-4727)

Feature — compare only a page range of a PDF

PdfCompareOptions.PagesSetup restricts comparison to part of a document, which is useful for large PDFs where only a section is under review.

import com.groupdocs.comparison.options.PagesSetup;
import com.groupdocs.comparison.options.PdfCompareOptions;

PagesSetup pagesSetup = new PagesSetup();
pagesSetup.setStartPage(3);
pagesSetup.setEndPage(7);

PdfCompareOptions options = new PdfCompareOptions();
options.setPagesSetup(pagesSetup);

Scope.

  • StartPage and EndPage are 1-based and inclusive. Either may be left null, meaning “from the first page” or “to the last page”.
  • The range is clamped to the actual page count and applied to both the source and the target document before any other processing.
  • Combines with DisplayMode, so a page range can be compared side by side. (COMPARISONNET-4731)

Feature — change location in spreadsheet comparison

For Cells comparison (XLSX, CSV, ODS and related formats) each ChangeInfo now reports where the change happened, so a change can be resolved back to a cell without re-parsing the document.

import com.groupdocs.comparison.options.GetChangeOptions;
import com.groupdocs.comparison.result.ChangeInfo;

for (ChangeInfo change : comparer.getChanges(new GetChangeOptions())) {
    Integer row = change.getRow();              // zero-based, null when not applicable
    Integer column = change.getColumn();        // zero-based, null when not applicable
    String header = change.getColumnHeader();   // text from the first worksheet row
    System.out.printf("%s at row %s, column %s (%s)%n",
            change.getType(), row, column, header);
}

Scope.

  • getRow() and getColumn() return zero-based indices; getColumnHeader() returns the text of the matching column taken from the first row of the worksheet when it holds header values.
  • All three return null for comparers that do not expose cell coordinates, so the fields are safe to read for any format. (COMPARISONNET-4767)

Feature — CSV results show inserted and deleted values

CSV output carries no character styling, so until now changes were invisible in a CSV result file. Inserted values are now wrapped in parentheses and deleted values in square brackets when the save format is CSV. Other save formats are unaffected. (COMPARISONNET-4769)

Change — inline diff rendering for text and JSON comparison

Text and JSON results are now rendered as a true inline diff. Every newline in the compared content starts a new block, and within a line unchanged, inserted and deleted runs are emitted next to each other, so a change is shown in the context of its line instead of on a separate numbered row.

Scope.

  • No public API changes — Comparer, compare options and save options are used exactly as before for .txt, .json and related formats.
  • The result markup changed: insertions and deletions are now <ins> and <del> elements coloured from InsertedItemStyle and DeletedItemStyle, the body uses white-space: pre-wrap, and the former line-number prefixes and background-coloured spans are gone. Code that scraped the previous HTML output needs updating. (COMPARISONNET-4772)

Fix — paragraph and table layout in PDF results

Paragraph rendering no longer hands a whole paragraph to the layout engine and hopes for the best. Text segments are grouped into visual lines using measured segment widths against the width actually available on the page, and each segment is then drawn at its own position. This removes lines collapsing onto one another and neighbouring segments overlapping horizontally, and text that the comparison inserts now wraps where it would really wrap rather than being clipped to the original bounding box.

Table handling changed alongside it. Tables detected by the Aspose table absorber are used directly, with the previous reconstruction from drawing operators kept as a fallback. On the rendering side the default black cell grid is gone: borders come from the colours detected in the source, and cells or tables without a detected border draw nothing, where previously a white rectangle was still visible against the page.

Symptom that is resolved. Comparison results for PDFs with wrapped paragraphs, multi-column footers or bordered tables could show overlapping text, paragraphs merged into a single line, and a duplicated or phantom table grid. (COMPARISONNET-4751, COMPARISONNET-4763, COMPARISONNET-4707, COMPARISONNET-4718)

Fix — Excel comparison corrupted cells holding error values

Character-run restyling is now applied only to cells whose value is a string. Cells holding numeric or error values are left alone.

Symptom that is resolved. Comparing workbooks that contain error values such as #DIV/0! produced a corrupted result document. (COMPARISONNET-4748)

Fix — corrupted font subsets in PDF results

Corrupted font subsets are now detected from the font’s base name, and the pass that drops unused fonts runs once for the whole document instead of once per affected font, which also shortens processing of PDFs with many embedded subsets. (COMPARISONNET-4732, COMPARISONNET-4733)

Change — Aspose engine libraries updated

The underlying Aspose libraries were updated: Words to 26.3, Cells to 26.3, PDF to 26.2, Slides to 26.2, Imaging to 25.12, Diagram to 25.10, PSD to 25.10, Tasks to 25.9, CAD to 24.6.1, BarCode to 25.5.

Scope.

  • No public API changes in GroupDocs.Comparison as a result of the update.
  • Rendering and text extraction of the underlying engines changed between these versions, so comparison results and generated previews may differ in detail from previous releases.
  • Slide previews and slide-to-image conversion now write directly to the target stream, removing an intermediate bitmap copy.
  • DWT recognition in CAD detection widened: AutoCAD 2000 through 2018 DWT files are now identified as DWT, where before they were reported as an unknown type.

Resources

1 Like