首页 > 解决方案 > 如何使用python在pdf文件中查找发票表的区域坐标?

问题描述

如何使用python在pdf文件中查找发票表的区域坐标?我目前正在使用 camelot 或 tabula 从 pdf 文件中提取表格。但是我想知道是否有办法提取每个表格的区域坐标,以便我可以相应地自定义

标签: pythonextractinvoicetabulapython-camelot

解决方案


在 Camelot 中,表格坐标在表格属性中指定_bbox

例子:

import camelot

tables=camelot.read_pdf('your_doc.pdf', pages='1-end')

for i,table in enumerate(tables):
    print(f'table id: {i}')
    print(f'page: {table.page}')
    print(f'coordinates: {table._bbox}')

推荐阅读