How to adjust line thickness (aka parser seeing empty cells)? #1092
enrac5
started this conversation in
Ask for help with specific PDFs
Replies: 1 comment 1 reply
-
Hi @enrac5, and thanks for your interest in this library. Semi-regular tables like this can be a bit difficult to work with at first. The key to understanding it is that there is an entry in each row array for each cell horizontal "position" in the table. In this case, the right border of the It's not ideal, and something I'd like to make more intuitive / better-structured in future versions of |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to parse a PDF (see attached)
Test_R1.pdf
def process_PDF(pdf_path: str): with pdfplumber.open(ccsl_pdf_path) as pdf: for page in pdf.pages: tables = page.extract_tables() for table in tables: for row in table: print(row)
I get a printout like this:
['COMBINED CONTINUITY & DIALOGUE', None, None, None, None, 'MASTER ENGLISH SUBTITLE/SPOTTING LIST', None, None, None, None]
['Shot', 'Footage/\nTimecode', None, 'Shot Description/Dialogue', None, 'Title', 'Start', 'End', 'Dur.', 'Subtitle/Spotting']
['', None, None, None, None, None, None, None, None, None]
Notice the second row, there's a 'None' entry after Timecode. The table debugger shows this image (attached).
![tmpatcgtdy7](https://private-user-images.githubusercontent.com/59802389/303448466-cf647ca3-7df1-4e3e-960a-11b75f47cc04.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwMzcxNzAsIm5iZiI6MTcyNjAzNjg3MCwicGF0aCI6Ii81OTgwMjM4OS8zMDM0NDg0NjYtY2Y2NDdjYTMtN2RmMS00ZTNlLTk2MGEtMTFiNzVmNDdjYzA0LlBORz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTExVDA2NDExMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdmMjAyOTE3NzA3M2U0MjM5NWRmYmNhZjliMDBiNTY1ODIzOGJjZTVmOWFjOTRiMTBlMWJkNDY0OTlhOWU1OTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DeAvebLqnIVsnNLuRTXE8YY42ZxhYxBTtrGlVj2ltFg)
Which doesn't immediately explain to me why I'm seeing that output, does anyone have any ideas what I'm doing wrong here? For what it's worth, other PDFs (all word docs printed to PDF) don't seem to behave like this.
Beta Was this translation helpful? Give feedback.
All reactions