Find PDF Dimensions with Camelot

做~自己de王妃 提交于 2020-01-11 09:39:10

问题


I am using Camelot to read complete PDFs and extract about 112 attributes from each one.

I use table areas to extract the attributes

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

The issue is the table area is not constant for the same attribute across all documents. Sometimes I would find the same attribute a few pixels down in x or y-coordinates i another document.

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

Is there a way to get the exact attribute from the same area regardless of extraction of any document?


回答1:


Maybe the option table_regions (introduced in 0.7) can help you.

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

"When table_regions is specified, Camelot will only analyze the specified regions to look for tables."

You can define a larger table_regions area and Camelot will search for tables in this area.




回答2:


Camelot uses opencv's coordinate system, and the dimensions can be obtained using opencv's .shape

See source code for camelot image processing here and opencv's documentation here



来源:https://stackoverflow.com/questions/54176697/find-pdf-dimensions-with-camelot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!