问题描述
我可以使用iText API比较两个PDF文件吗?我已经在stackoverflow上进行了各种方法来比较PDF文件,例如工具,一些实用程序,例如imagemagick等。
我想比较的PDF是带有图形,表格和文本等的财务报告。
We必须比较大量文件,并希望通过命令行实用程序来完成。有一个ComparePDF命令行工具,但它只输出两个文件是否存在差异。我们想要打印文件差异日志。我们可以通过iText实现这一目标吗?
Can I use iText API for comparing two PDF files? I have gone through various approaches on stackoverflow for comparing PDF files such as tools, some utilities such as imagemagick etc.The PDFs which I wish to compare are fiancial reports with graphs, tables and text etc.We have to compare a large number of files and would like to do it through command line utility. There is a ComparePDF command line tool but its just outputs whether two files are conatining differences. We will like to print a log of file differences. Can we accomplish this through iText?
推荐答案
您想要比较什么? iText可用于比较结构和语法,但......两个看起来与人眼完全相同的PDF可能在内部具有完全不同的结构和语法。
What do you want to compare? iText could be used to compare structure and syntax, but... two different PDFs that look identical to the human eye, may have a completely different structure and syntax internally.
在iText,我们编写了JUnit测试,使用GhostScript创建每个页面的图像。这些图像在每个像素的像素基础上相互比较。
At iText, we have written JUnit tests that use GhostScript to create images of each page. These images are compared to each other on a pixel per pixel basis.
我们还在JUnit测试中使用iText,但这些测试在结构和语法上比在内容。
We also use iText in JUnit tests, but these tests look at the structure and the syntax more than at the content.
这篇关于用于PDF比较的iText API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!