How to compare two PDF files in Java

Just download the sample code and like to run “compare two pdf files”…

(1)Where to get “GroupDocs.Total.Java.lic” for free trial?

(2)Currently, most of sample code show comparing pdf files and write result to an output file. Do you provide returned some Objects(ChangeInfo/Rectangle?) which shows the difference so that we could highlight in our application? If yes, could you provide some sample code?

Many thanks!

Ruhong

@ruhongcai,

Thanks for taking interest in GroupDocs.Comparison for Java and posting your concerns.

You can avail temporary license here. Please follow the wizard and on step 5 of 8 you can get/request temporary license. You can follow steps given in this sample document for further help - Wizard.zip (152.9 KB)

You can impose ComparisonSettings while comparing two documents.

ComparisonSettings settings = new ComparisonSettings();  
settings.setGenerateSummaryPage(true);

This code snippet will give you comparison summary. Furthermore, you can highlight changes as follows:

settings.getInsertedItemsStyle().setColor(Color.RED);

Please visit this article for further information.
You can get comparison results in ICompareResult object.

ICompareResult result = comparison.compare(sourcePath, targetPath, settings);

@atirtahir3
Hi, I have same problem, I followed and got GroupDocs.Comparison.lic, but when I built the Java project, the output was: “License is validated” and nothing followed at all. What do I need to do to get the results of comparing 2 files. Look forward to the tutorial from you or maybe the demo video is better. Thanks.

@hung.hoangmanh,

Your query is addressed here. You can always raise your concerns in new posts.

Hello; I also wanted to got a support from Groupdocs.com , but misfortune

contact is not working I don’t Why That is why I Came to reply please give me an Email to communicate u

@shafici,

Please feel free to create a new post here and share your concerns.