使用java比较两个pdf文件(方法) [英] compare two pdf files (approach) using java

查看:145
本文介绍了使用java比较两个pdf文件(方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个java类来比较两个pdf文件并指出差异(文本/位置/字体的差异)使用某种突出显示.我最初的方法是使用 pdfbox 使用 pdfbox 解析文件,并将提取的文本存储在一些有助于我进行比较的数据结构中.是否有任何可以提取文本、保留格式、帮助我进行索引和比较的 Java 库.我可以为此使用 tika/google 的 diff-match.tika 以 xhtml 的形式提取文本,但如何比较两个 xhtml 文件?

i need to write a java class that compares two pdf files and points out the differences(differences in text/position/font) using some sort of highlighting. my initial approach was use pdfbox to parse the file using pdfbox and store the extracted text using in some data structure that would help me with comparing. Is there any java library that can extract the text,preserve the formatting,help me with indexing and comparing.Can i use tika/ google's diff-match for this. tika extracts text in the form of xhtml but how can i compare two xhtml files?

推荐答案

我不得不在我的项目中比较大量的 pdf 文件.我的要求是逐个像素地比较 pdf 文件.经过大量的谷歌搜索,我找不到任何好的东西,我最终为此创建了自己的 pdf 实用程序.

I had to compare tons of pdf files in my project. my requirement was to compare the pdf files by pixel by pixel. After a lot of googling and as i could not find anything good, I ended up creating my own pdf utility for this purpose.

请查看此博客以了解更多详情 &jar包下载.

Please check this blog for more details & jar download.

http://www.testautomationguru.com/introducing-pdfutil-to-compare-pdf-files-extract-resources/

这篇关于使用java比较两个pdf文件(方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆