pdfquery未在BBOX中返回值

2024-09-30 16:41:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用pdfquery库返回所需的pdf bbox中的文本。在

import pdfquery

pdf = pdfquery.PDFQuery("C:/Users/tyler.cowan/Desktop/PDF Miner/test.pdf")

test =  pdf.extract([
      ('UWI/API', 'LTTextLineHorizontal:in_bbox("35.28,700.56,127.44,717.84")'),
 ])

print(test)

我首先从返回的页面的左上角定义了bbox

^{pr2}$

然后我从页面的左下角定义了bbox,并返回了类似的结果。然后我定义了一个包含整个页面8.5“x11”的bbox,并返回更多的值而不是所有文本。我在“快速入门”下面跟着Documentation时,是否做错了什么。我使用的是python2.7


Tags: test文本import定义pdf页面usersdesktop
1条回答
网友
1楼 · 发布于 2024-09-30 16:41:24

它在“批量数据抓取”下的页面下面说了这一点:

(It’s often helpful to start with ('with_formatter', 'text') so you get results like “Michaels” instead of [<'LTTextLineHorizontal>]. See Special Keywords below for more.)

相关问题 更多 >