12
tables = camelot.read_pdf(r"C:\Users\Ayush ShaZz\Desktop\Code_Python\FoodCaloriesList.pdf")
for table in tables:
    print(table.df)

Its reading only the first page. Someone please help me out

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Ayush ShaZz
  • 316
  • 3
  • 7

2 Answers2

9

If you want to read all the pages in a pdf then use:

camelot.read_pdf('your.pdf', pages='all')
Richtea88
  • 111
  • 1
  • 5
7

By default Camelot only uses the first page, see here: https://camelot-py.readthedocs.io/en/master/user/quickstart.html

From the link, you can do multiple pages:

camelot.read_pdf('your.pdf', pages='1,2,3')

Or, if you want to use them all:

camelot.read_pdf('your.pdf',pages=1,4-10,20-end )
Kamuish
  • 118
  • 6
  • tables = camelot.read_pdf(r"C:\Users\Ayush ShaZz\Desktop\Code_Python\FoodCaloriesList.pdf",pages='all',multiple_table='true',flavor='lattice') for table in tables: print(table.df) I already tried that using this the heading doesn't come in correct format ................................................. the heading is shifted towards left and the content of the table is perfectly printed .... or i will post it as my next question pls help me out .. – Ayush ShaZz Jun 27 '19 at 02:35
  • Btw page indices start from 0 => pages='0,1,2' – petko10 Oct 16 '19 at 13:05