iText搜索,突出显示,结果图像 [英] iText Search, Highlight, image of result

查看:150
本文介绍了iText搜索,突出显示,结果图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想执行以下任务:
1 - 在pdf中查找单词
2 - 突出显示该pdf中的所有事件,
3 - 将突​​出显示的pdf保存为其页面的图像。

I want to Do these tasks: 1-find a word in pdf 2-highlight all occurrences in that pdf, 3-save highlighted pdf as images of its pages.

我该怎么做?
任何帮助将不胜感激。

How can I do this ? Any help will be appreciated.

推荐答案

com.itextpdf.text.pdf.parser.LocationTextExtractionStrategy

com.itextpdf.text.pdf.parser.LocationTextExtractionStrategy

它将为您提供页面上每一段文字的基线,上升和下降。您可以根据该信息构建单词和矩形。

It'll give you the baseline, ascent, and descent of every piece of text on the page. It's up to you to build words and rectangles from that information.

不容易,但可能。

之后那你只需要调用GhostScript或PDFBox或者可以渲染PDF的东西。几乎没有容易的部分,但它已经解决了很多次问题。

After that, you just need to call GhostScript or PDFBox or something that can render PDFs. Hardly "the easy part", but it's a solved problem many times over.

这篇关于iText搜索,突出显示,结果图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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