Free Support Forum -

Highlight style changes in PDF comparison using Java

I am using a trial license for compare for java 18.6 and I have turned on summary report and style change detection in the settings. I am using 2 PDFs with a small number of changes between them. The three big style changes I made was one line I change the font, a paragraph was indented, and some words were highlighted in the signature block. It detected 26 changes but only highlighted 5 words whose casing changed in the address block. The font change, paragraph indent, and highlighting were not highlighted green. I also don’t know what the 26 changes detected were since only a few things were highlighted green. I have attached a zip file with the two PDFs compared and the results.

The code used was:
private static void compareFiles(String file1, String file2, String reportPath)
ComparisonSettings settings = null;
Comparer comparer = null;
ICompareResult result = null;
String suffix = null;

		comparer = new Comparer();
		settings = new ComparisonSettings();
		suffix = file1.substring(file1.lastIndexOf("."));
			suffix = "." + suffix;

		result = FileInputStream(file1), new FileInputStream(file2), settings);
		result.saveDocument(reportPath + suffix);
		System.out.println("Finished compare " + result.getChanges().length + " changes.");
		System.out.println("Report written to " + reportPath + suffix);
	catch(Exception e)
} (263.4 KB)


We’ve logged this issue in our internal issue tracking system with ID:COMPARISONJAVA-425. We’re further investigating it. As we have any update, we shall apprise you.


Your reported issue is resolved in latest release of the API. Please integrate 18.6.1 in your project.

The report is better with 18.6.1 but it is still not finding a lot of changes. It is putting the inserted footer up into the middle of the address block at the top of the page and it is missing the font change and the indent change. I have attached a zip file with the two PDFs being compared and the result using the same code as above but with the 18.6.1 (291.2 KB)


Thank you for your feedback. We shall further investigate, improve the comparison results and update you.


Please download and integrate 18.6.2 version of the API. It will improve your comparison results.

Thanks for the update, I haven’t had a chance to test it yet. I will get to it as soon as I can.



I re-ran the test and the count now matches the number of colored items. However, the footer, which didn’t change, is still shown as a change in part of the address block at the top and the font change, paragraph indent, and highlighting are still not found as format changes. I have attached the PDFs used for the compare and the report generated. The same code as before was used to compare the two PDFs. (291.2 KB)


When API compares both source and target documents. It finds footer in one document while missing in the other document. Hence, footer is shown in the output (as it is a difference/change between two docs).

If there is a change found, you can highlight it. For instance, an inserted item style change can be highlighted as follows:


Sorry it took so long to get back to you.

I see the footer is, indeed, a change. It is in PDF1 and not in PDF2. It still doesn’t explain why it is shown as a deleted element at the top of the page in the middle of the address block.

I used the following to set the style changed color to yellow


and I get a summary with yellow stating there are no style changes. There is one style change. In PDF1 the paragraph above the signature is indented and in PDF2 it is not indented.

I have included a zip file with the original two PDFs and the report PDF. (291.4 KB)


We are investigating these issues. As we have any further update, you shall be notified.