6

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?

A.A. F
  • 349
  • 5
  • 16

2 Answers2

2

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

Jinx
  • 511
  • 1
  • 3
  • 10