Camelot is reading only the first page of the pdf
Asked Answered
D

2

13
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

Daria answered 26/6, 2019 at 16:21 Comment(0)
K
10

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

camelot.read_pdf('your.pdf', pages='all')
Koniology answered 16/9, 2021 at 9:1 Comment(1)
I should specify, it has to be lowercase, 'All' or 'ALL' will raise an exceptionKoniology
W
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 )
Wyant answered 26/6, 2019 at 16:24 Comment(2)
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 ..Daria
Btw page indices start from 0 => pages='0,1,2'Kier

© 2022 - 2024 — McMap. All rights reserved.