python - 使用 Camelot 查找 PDF 尺寸

标签 python pdf-extraction python-camelot

我正在使用 Camelot 读取完整的 PDF 并从每个 PDF 中提取大约 112 个属性。

我使用表格区域来提取属性

 test_variable = camelot.read_pdf(filename, flavor='stream', 
                 table_areas=['38, 340 ,50, 328']) 

问题是对于所有文档中的相同属性,表区域并不是恒定的。有时我会在另一个文档中的 x 或 y 坐标下方几个像素处找到相同的属性。

 test_variable = camelot.read_pdf(filename, flavor='stream', 
                 table_areas=['38,350,50,338']) 

有没有办法从同一区域获取准确的属性,而不管提取任何文档?

最佳答案

也许选项 table_regions(0.7 中引入)可以帮助您。

https://camelot-py.readthedocs.io/en/master/user/advanced.html#specify-table-regions

“当指定table_regions时,Camelot只会分析指定的区域来查找表。”

您可以定义一个更大的table_regions区域,Camelot将搜索该区域中的表。

关于python - 使用 Camelot 查找 PDF 尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54176697/

相关文章:

css - Confluence:有没有办法在全局 PDF 样式表中使用空间变量?或者以某种方式将其包含在 PDF 导出中

javascript - 当需要路径或链接时将 pdf 文件传递​​给函数

python - 如何使用 python 从 pdf 文件中使用 camelot 提取表名和表?

python - 删除 PDF 文档中的空格

python - NoReverseMatch at/product_view/1/Reverse for 'cart_add' with argument '(' ', )' not found. 1 pattern(s) tried: [u' cart/add/(?P<product_id>\\d+)/$']

python - 在大数据上评估数学表达式的性能

python - 从 FTP 文件夹下载所有文件时出现 "Permission denied"错误

node.js - 我想在本地上传一个文件,然后将该文件上传到 S3。然而 Multer 一次只允许其中之一

python - Camelot 只阅读 pdf 的第一页

查询MySQL时Python报错-- 'int'不支持buffer接口(interface)