1

我们需要集成到现有的 java web 应用程序中,这是一个允许用户比较 2 个 pdf 文档并查看差异的新功能。所以,我开始搜索一些已经存在的库或工具(开源或商业),可以帮助我解决这个请求。有谁知道是否存在这种应用程序?那需要2个pdf,比较它们并显示差异?

在此先感谢,马达琳娜

4

2 回答 2

0

我的回答可能不令人满意,但这个项目来自 apache -> http://pdfbox.apache.org/

可以帮助你。您可以将 pdf 转换为文本文件并进行比较。

于 2012-04-04T12:56:20.393 回答
0

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

于 2015-05-26T07:30:52.670 回答