使用Python突出显示PDF中的文本 [英] Highlight text in a PDF with Python

查看:459
本文介绍了使用Python突出显示PDF中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的PDF数据集开发自定义搜索引擎.

I'm working on custom search engine for my PDF data corpus.

我有一个转换层,能够将PDF内容转储到文本中(使用Apache Tika和GROBID).我已经完成搜索层和返回搜索结果列表的视图.

I have a transformation layer which is able to dump PDF content to text (using Apache Tika and GROBID). I have finished search layers and the view which return search results listing.

现在,我想在原始PDF上为出现搜索字词的行添加突出显示功能.是的,如果有必要,我想修改PDF文件.

Now, I'd like to add highlighting feature on original PDF for the lines, where search terms was appeared. Yes, I wanna modifiy PDF files if it is necessary.

是否可以在PDF文件中突出显示文本? PDFMiner或PyPDF2或其他Python库是否可以做到这一点?

Is there any way for highlight text inside in PDF file? Are PDFMiner or PyPDF2 or other Python library is able to do that?

...还是您可以要求其他服务,也许是外部服务?

... or can you recommand other, maybe external service for it?

推荐答案

您可以使用 PyPDF2 .

为了找到文本的位置,请查看此答案.

In order to find the text's location, check out this answer.

这篇关于使用Python突出显示PDF中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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