aspose file tools*
The moose likes Java in General and the fly likes Java code to compare 2 PDF files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java code to compare 2 PDF files" Watch "Java code to compare 2 PDF files" New topic
Author

Java code to compare 2 PDF files

Uday Kumar Shanth
Greenhorn

Joined: Jan 08, 2013
Posts: 3
Can i get the Java Code which compare the differences between 2 PDF files and highlight or store the diffrence in separate file.

Any Help is really appriciated!

Thanks,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41806
    
  62
Define "difference" - ar you just talking about the text it contains, or also other things like layout etc.? If it's just about the text then you can extract the text from both PDFs using a library such as PDFBox and maybe generate diff output.


Ping & DNS - my free Android networking tools app
Uday Kumar Shanth
Greenhorn

Joined: Jan 08, 2013
Posts: 3
i have to Compare the entire content (Image, space, text, numbers..etc) of the 2 PDF files, i have PDFBOX Library, but not sure how to code to compare 2 PDF files


Thanks,
Uday Kumar
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4540
    
    5

Uday, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/forum-lobby/67413-java-code-compare-2-pdf-files.html


luck, db
There are no new questions, but there may be new answers.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41806
    
  62
That's going to be tricky. Can you give an example of two simple PDFs, and what their "difference" would be according to your definition? Especially two that contain differing images.

There will definitely be no code you can just copy from somewhere - lots of experimentation and programming on your part will be required. You should expect this to be a lengthy process.
Uday Kumar Shanth
Greenhorn

Joined: Jan 08, 2013
Posts: 3
Hi,

Example: 1. The text present in PDF1 is not matching/present in PDF2.
2. The position/line of the text present in PDF1 is not Matching with PDF2
3. The image/Image position present in PDF1 is not matching with PDF2
4. The result should generated to new doc/PDF/text

Thanks,
Uday Kumar
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3527
    
  15
Uday Kumar Shanth wrote:Hi,

Example: 1. The text present in PDF1 is not matching/present in PDF2.
2. The position/line of the text present in PDF1 is not Matching with PDF2
3. The image/Image position present in PDF1 is not matching with PDF2
4. The result should generated to new doc/PDF/text

Thanks,
Uday Kumar

You need to read NotACodeMill in particular and probably other entries from HowToAskQuestionsOnJavaRanch


Joanne
 
Consider Paul's rocket mass heater.
 
subject: Java code to compare 2 PDF files