Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extraction skipping every alternate line and also not extracting headers #4017

Open
chelsud123 opened this issue Nov 4, 2024 · 0 comments
Open

Comments

@chelsud123
Copy link

chelsud123 commented Nov 4, 2024

Description of the bug

In the attached PDF, I am trying to extract the last table. PyMuPDF is extracting it, but skipping every alternate line and is also not extracting the column headers. The following items are attached:

  1. Problem_document.pdf : The PDF from which the table has been extracted
  2. Table_error.png : The erroneous extraction
    Problem_document.pdf
    Table_error

How to reproduce the bug

import pymupdf
from IPython.display import display, Image

doc = pymupdf.open('Problem_document.pdf')
page = doc[idx]
tabs = page.find_tables(add_lines=None)
print(f"{len(tabs.tables)} found on page {idx}")
if tabs.tables:
   for idt in range(0, len(tabs.tables)):
       df_test = pd.DataFrame(tabs[idt].extract())
       display(df_test)

PyMuPDF version

1.24.13

Operating system

Windows

Python version

3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant