突出显示PDF行 [英] Highlight pdf line

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

问题描述



请任何人帮助我。我真的不知所措,我不知道如何突出显示pdf的特定行。最好是有人可以提供示例代码或伪代码给我

谢谢


Please can any one help me. I am really stuck I don't know how to highlight particular line of pdf. It would be better if any one can provide me sample code or pseudo code
Thanks

推荐答案

目前正在处理同一件事,这确实不是一件容易的事。

I'm working on the same thing at the moment and it's not trivial indeed.

根据我的判断,您需要先加载文本并将其排成一行。如果您使用的是Poppler,则 Poppler.Page.textList()将为您提供TextBoxes列表和 TextBox.hasSpaceAfter()会在返回 False 时告诉您行尾。

From what I can figure out you need to load the text and arrange it in lines first. If you are using Poppler, the Poppler.Page.textList() will provide you with a list of TextBoxes and a TextBox.hasSpaceAfter() will tell you the end of line when returning False.

我正在使用Qt4前端,因此每个TextBox都有一个QRect,从中我可以找出要突出显示单词的位置。 lirstWordOfLine.geometry()。united(lastWordOfLine.geometry())会突出显示一条线,这将提供要突出显示的线的几何形状。

I am using the Qt4 frontend, so the each TextBox has a QRect from which I can figure out where to highlight a word. Highlighting a line is more or less lirstWordOfLine.geometry().united(lastWordOfLine.geometry()) which will provide the geometry of the line to highlight.

现在我不知道如何保存文档中高亮显示的坐标。

Now what I can't figure out is how to save the coordinates of the highlights in the document.

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

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