Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

java - iText API for PDF comparison

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.

We also use iText in JUnit tests, but these tests look at the structure and the syntax more than at the content.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...