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

查看:1194
本文介绍了使用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天全站免登陆