camelot-dev / camelot-dev/camelot

Is it possible to extract only tables from pdf using camelot? Used flavor as stream, but still getting text paragraphs as tables

Open
#350 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.8k
Forks
546
Avg merge
3d 17h
Merged PRs (30d)
3

Description

path1 = r"C:\Users\Downloads\PDF Extraction Project\Compensation_document.pdf"
tables = camelot.read_pdf(path1, flavor='stream', pages='all')

print("Total tables extracted:", tables.n)

writer = pd.ExcelWriter(r"c:\temp\Compensation_document.xlsx")
i = 1
for i in range(tables.n):
print("-----------------------------------------",i)
df2 = pd.DataFrame()
sname = "Sheet" + str(i+1)
df2 = tables[i].df
df2.to_excel(writer,sheet_name = sname,index = False )
print(tables[i].df)
writer.save()

For this Code I tried putting option sas edge_tool=500, row_tool=10, col_tool=10 etc. But still text paragraphs are detected as tables.
Also how to automatically specify area regions for tables in pdf. and get coordinates automatically for code.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior with Compensation_document.pdf and the camelot.read_pdf call using flavor='stream'. Inspect how the extracted tables include paragraph text and how table areas or coordinates are represented; done would mean identifying a reliable way to exclude paragraphs and specify table regions automatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.