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

Closed
chelsud123 opened this issue Nov 4, 2024 · 1 comment
Closed
Labels
wontfix no intention to resolve

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

@JorjMcKie JorjMcKie added the wontfix no intention to resolve label Dec 1, 2024
@JorjMcKie
Copy link
Collaborator

Sorry for the delay.
We have checked out various settings and came to the result that the tables situation on this page as a whole and also the making of each single table cannot be (correctly) detected by the table finder.
You will have to develop own code which for instance adds information via the add_lines parameter to help the table finder.

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

No branches or pull requests

2 participants