问题
We need to integrate into an existing java web application, a new feature that allows the user to compare 2 pdf documents and see the differences. So, I started to search for some already exiting library or tool (open source or commercial) that could help me solve this request. Does anyone know if exists this kind of application? That would take 2 pdf, compare them and display the differences?
Thanks in advance, Madalina
回答1:
My answer may not be satisfactory , but this project from apache -> http://pdfbox.apache.org/
may help u. You can convert the pdf's to text file and compare it.
回答2:
Hello i made a PDF comparision project built on PDFBOX you can donwload source code from link
Example Usage is mentioned below it performs three levels of comparison you can simply add a loop by saving target and source files name in a list and then calling its comparison functionalities .
pdfComparison cmp=new pdfComparison();
//Text Comparision page by page if(cmp.textComparision("ReferencePDF\\PDF2_302.pdf","C:\\\PDF2_305.pdf"))
{
System.out.print("\n********PDF text is identical******* ");
}
else
{
System.out.print("\n********PDF text is not identical******* ");
}
//Extract all images in PDF and compare
cmp.extract_ALL_Images_ThenCompare("PDF2_302.pdf","PDF2_302.pdf");
//Convert Both PDF pages into JPG and perform image comparison
cmp.PDF_Convert_To_Jpeg_Comparision("PDF2_302.pdf","PDF2_302.pdf");
You will see all image differences in folder Differences in the project . If any issue just put a message for me
来源:https://stackoverflow.com/questions/10011432/web-based-application-for-comparasion-of-2-pdf-documents