Describe the bug
Improper parsing of a table's last row if it's at the bottom of a page and not closed.
See document cited below on pages 117,134,317 for cases resulting in bad behavior. See Table on Page 201 for good behavior.
Have you tried repairing the PDF?
I can't run the repair function on my machine because it requires a library I can't install (ghostscript).
Code to reproduce the problem
with pdfplumber.open("./RDTE - Vol 2 - Budget Activity 4B.pdf") as pdf:
for page_num in [117,134, 201, 317]:
print (f"Page {page_num} **********************")
page = pdf.pages[page_num-1]
rows=page.extract_table()
for iRow,row in enumerate(rows):
print(f"Row {iRow:<3} ",end="")
print((" ".join([f"{ii}:'{xx}'" for ii,xx in enumerate(row)])).replace("\n"," "))
Rows with error:
| Row |
Page |
| 16 |
117 |
| 1 |
134 |
| 14 |
317 |
PDF file
Here's an example of the PDF where it fails: Look at pages 117, 172, 317 of this DoD Budget document. https://www.asafm.army.mil/Portals/72/Documents/BudgetMaterial/2027/Discretionary%20Budget/rdte/RDTE%20-%20Vol%202%20-%20Budget%20Activity%204B.pdf
RDTE - Vol 2 - Budget Activity 4B.pdf
Expected behavior
It should have parsed the row's 18 cells into the returned array according to column (as it did with the other rows on those pages). See results for Page 201 for good behavior ==> last row in table is closed and parses correctly.
note that some table rows don't result in 18 columns which is not a problem.
Actual behavior
It puts the entire row into column 0 and puts None everywhere else. See error rows on the dump below.
Screenshots
Not Closed (page 134):

Closed Table: (page 201):
Here's the output of that code above:
0.11.4
Page 117 **********************
Row 0 0:'Exhibit R-3, RDT&E Project Cost Analysis: PB 2027 Army' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'Date: April 2026' 15:'None' 16:'None' 17:'None'
Row 1 0:'Appropriation/Budget Activity 2040 / 4' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'R-1 Program Element (Number/Name) PE 0604115A / Technology Maturation Initia tives' 8:'None' 9:'None' 10:'None' 11:'None' 12:'Project (Number/Name) AX3 / Technology Maturation Initiatives' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 2 0:'FY 2027 FY 2027 FY 2027 Product Development ($ in Millions) FY 2025 FY 2026 Base OOC Total' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 3 0:'None' 1:'None' 2:'None' 3:'None' 4:'FY 2025' 5:'None' 6:'FY 2026' 7:'None' 8:'None' 9:'FY 2027 Base' 10:'None' 11:'FY 2027 OOC' 12:'None' 13:'FY 2027 Total' 14:'None' 15:'None' 16:'None' 17:'None'
Row 4 0:'Cost Category Item' 1:'Contract Method & Type' 2:'Performing Activity & Location' 3:'Prior Years' 4:'Cost' 5:'Award Date' 6:'Cost' 7:'None' 8:'Award Date' 9:'Cost' 10:'Award Date' 11:'Cost' 12:'Award Date' 13:'Cost' 14:'None' 15:'Cost To Complete' 16:'Total Cost' 17:'Target Value of Contract'
Row 5 0:'Multinetwork - 5G Capability' 1:'TBD' 2:'DEVCOM C5ISR : Fort Belvoir, VA' 3:'35.526' 4:'35.288' 5:'' 6:'51.894' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'122.708' 17:'-'
Row 6 0:'Consolidated prototype platform for Joint Common Artificial Intelligence / Autonomous Operations, Da' 1:'TBD' 2:'TBD : TBD' 3:'12.520' 4:'16.155' 5:'' 6:'25.103' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'53.778' 17:'-'
Row 7 0:'Next Generation Command and Control (NGC2) Prototyping' 1:'TBD' 2:'PEO C3N : Aberdeen, MD' 3:'-' 4:'20.000' 5:'' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'20.000' 17:'-'
Row 8 0:'Aviation Lightweight Armor' 1:'TBD' 2:'DEVCOM AvMC : Ft. Eustis, VA' 3:'-' 4:'3.321' 5:'' 6:'3.920' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'7.241' 17:'-'
Row 9 0:'Electro-Magnetic Battlespace Shaping and Protection (EM-BSP)' 1:'TBD' 2:'JPEO A&A : Various' 3:'-' 4:'10.569' 5:'' 6:'18.550' 7:'None' 8:'' 9:'10.800' 10:'' 11:'-' 12:'' 13:'10.800' 14:'None' 15:'0.000' 16:'39.919' 17:'-'
Row 10 0:'Combination Soldier and Logistics Aerial Insertion' 1:'TBD' 2:'DEVCOM SC : Natick, MA' 3:'-' 4:'2.595' 5:'' 6:'2.500' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'5.095' 17:'-'
Row 11 0:'Containerized Weapon System - Counter UAS' 1:'TBD' 2:'DEVCOM AvMC : Redstone Arsenal, AL' 3:'-' 4:'8.926' 5:'' 6:'2.500' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'11.426' 17:'-'
Row 12 0:'Expeditionary Field Artillery Sensor (ExFAS)' 1:'TBD' 2:'DEVCOM C5ISR : Aberdeen Proving Ground, MD' 3:'-' 4:'2.175' 5:'' 6:'13.611' 7:'None' 8:'' 9:'3.130' 10:'' 11:'-' 12:'' 13:'3.130' 14:'None' 15:'0.000' 16:'18.916' 17:'-'
Row 13 0:'Iron Sense' 1:'TBD' 2:'PEO IEWS : Various' 3:'-' 4:'9.936' 5:'' 6:'31.500' 7:'None' 8:'' 9:'31.700' 10:'' 11:'-' 12:'' 13:'31.700' 14:'None' 15:'0.000' 16:'73.136' 17:'-'
Row 14 0:'Critical Common Electronics for Scalable Unmanned Aircraft Systems (UAS)' 1:'TBD' 2:'PEO Aviation, PEO IEWS, Various : Various' 3:'-' 4:'8.511' 5:'' 6:'10.000' 7:'None' 8:'' 9:'12.000' 10:'' 11:'-' 12:'' 13:'12.000' 14:'None' 15:'0.000' 16:'30.511' 17:'-'
Row 15 0:'Electronic Warfare (EW) / Counter-Unmanned Aircraft Systems (C-UAS)' 1:'TBD' 2:'PEO IEWS, PEO C3N, various : Various' 3:'-' 4:'-' 5:'' 6:'22.000' 7:'None' 8:'' 9:'61.108' 10:'' 11:'-' 12:'' 13:'61.108' 14:'None' 15:'0.000' 16:'83.108' 17:'-'
Row 16 0:'PEO C3N, PEO Networks, Command, TBD IEWS, PEO Aviation, - - 9.341 15.189 - 15.189 0.000 24.530 - Control, Communications, various : Various' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Page 134 **********************
Row 0 0:'Exhibit R-4, RDT&E Schedule Profile: PB 2027 Army' 1:'None' 2:'None' 3:'Date: April 2026'
Row 1 0:'Appropriation/Budget Activity 2040 / 4' 1:'R-1 Program Element (Number/Name) PE 0604115A / Technology Maturation Initia tives' 2:'Project (Number/Name) AX3 / Technology Maturation Initiatives' 3:'None'
Row 2 0:'' 1:'None' 2:'None' 3:'None'
Page 201 **********************
Row 0 0:'Exhibit R-3, RDT&E Project Cost Analysis: PB 2027 Army' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'Date: April 2026' 15:'None' 16:'None' 17:'None'
Row 1 0:'Appropriation/Budget Activity 2040 / 4' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'R-1 Program Element (Number/Name) PE 0604121A / Synthetic Training Environ ment Refinement & Prototyping' 8:'None' 9:'None' 10:'None' 11:'None' 12:'Project (Number/Name) CR2 / STE Information Systems (TSS, TMT)' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 2 0:'FY 2027 FY 2027 FY 2027 Management Services ($ in Millions) FY 2025 FY 2026 Base OOC Total' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 3 0:'None' 1:'None' 2:'None' 3:'None' 4:'FY 2025' 5:'None' 6:'FY 2026' 7:'None' 8:'None' 9:'FY 2027 Base' 10:'None' 11:'FY 2027 OOC' 12:'None' 13:'FY 2027 Total' 14:'None' 15:'None' 16:'None' 17:'None'
Row 4 0:'Cost Category Item' 1:'Contract Method & Type' 2:'Performing Activity & Location' 3:'Prior Years' 4:'Cost' 5:'Award Date' 6:'Cost' 7:'None' 8:'Award Date' 9:'Cost' 10:'Award Date' 11:'Cost' 12:'Award Date' 13:'Cost' 14:'None' 15:'Cost To Complete' 16:'Total Cost' 17:'Target Value of Contract'
Row 5 0:'STE-SW (NGC) Program Management' 1:'Various' 2:'CPE ST3 : Orlando, FL' 3:'1.381' 4:'0.810' 5:'Jul 2025' 6:'2.845' 7:'None' 8:'Jan 2026' 9:'2.770' 10:'Oct 2026' 11:'-' 12:'' 13:'2.770' 14:'None' 15:'0.000' 16:'7.806' 17:'-'
Row 6 0:'STE-SW (TSS/TMT) Program Management' 1:'Various' 2:'CPE ST3 : Orlando, FL' 3:'-' 4:'4.389' 5:'Oct 2024' 6:'1.050' 7:'None' 8:'Dec 2025' 9:'6.290' 10:'Oct 2026' 11:'-' 12:'' 13:'6.290' 14:'None' 15:'0.000' 16:'11.729' 17:'-'
Row 7 0:'Subtotal' 1:'None' 2:'None' 3:'1.381' 4:'5.199' 5:'' 6:'3.895' 7:'None' 8:'' 9:'9.060' 10:'' 11:'-' 12:'' 13:'9.060' 14:'None' 15:'0.000' 16:'19.535' 17:'N/A'
Row 8 0:'Remarks STE- SW Program Management - FY2027 Base RDTE will provide program management, engineering and technical oversight, and travel for the TSS/TMT and NGC Program. FY 2027 FY 2027 FY 2027 Product Development ($ in Millions) FY 2025 FY 2026 Base OOC Total' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 9 0:'None' 1:'None' 2:'None' 3:'None' 4:'FY 2025' 5:'None' 6:'FY 2026' 7:'None' 8:'None' 9:'FY 2027 Base' 10:'None' 11:'FY 2027 OOC' 12:'None' 13:'FY 2027 Total' 14:'None' 15:'None' 16:'None' 17:'None'
Row 10 0:'Cost Category Item' 1:'Contract Method & Type' 2:'Performing Activity & Location' 3:'Prior Years' 4:'Cost' 5:'Award Date' 6:'Cost' 7:'None' 8:'Award Date' 9:'Cost' 10:'Award Date' 11:'Cost' 12:'Award Date' 13:'Cost' 14:'None' 15:'Cost To Complete' 16:'Total Cost' 17:'Target Value of Contract'
Row 11 0:'NGC Sustainment Modeling and Simulation' 1:'Option/ FFP' 2:'Phoenix Defense : Orlando, FL' 3:'4.383' 4:'2.346' 5:'Jul 2025' 6:'17.883' 7:'None' 8:'Jan 2026' 9:'12.255' 10:'Mar 2027' 11:'-' 12:'' 13:'12.255' 14:'None' 15:'Continuing' 16:'Continuing' 17:'Continuing'
Row 12 0:'NGC Intelligence and Electronic Warfare' 1:'Option/ FFP' 2:'General Dynamics : Orlando, FL' 3:'-' 4:'0.797' 5:'' 6:'3.941' 7:'None' 8:'May 2026' 9:'5.412' 10:'Mar 2027' 11:'-' 12:'' 13:'5.412' 14:'None' 15:'Continuing' 16:'Continuing' 17:'-'
Row 13 0:'NGC Maneuver/Fires/ Protection' 1:'Option/ FFP' 2:'Battle Road : Meridian, ID' 3:'-' 4:'12.861' 5:'Jul 2025' 6:'18.005' 7:'None' 8:'Jan 2026' 9:'14.200' 10:'Mar 2027' 11:'-' 12:'' 13:'14.200' 14:'None' 15:'0.000' 16:'45.066' 17:'-'
Row 14 0:'NGC Core Service (FKA Software Development)' 1:'Option/ Various' 2:'GDMS / Palantir : Orlando,FL' 3:'-' 4:'1.755' 5:'Jul 2025' 6:'43.455' 7:'None' 8:'Dec 2025' 9:'39.891' 10:'Jan 2027' 11:'-' 12:'' 13:'39.891' 14:'None' 15:'Continuing' 16:'Continuing' 17:'-'
Row 15 0:'NGC Cyber and Space Operations' 1:'Option/ FFP' 2:'Dignitas Technologies : Orlando, FL' 3:'-' 4:'-' 5:'' 6:'4.739' 7:'None' 8:'May 2026' 9:'6.292' 10:'Mar 2027' 11:'-' 12:'' 13:'6.292' 14:'None' 15:'Continuing' 16:'Continuing' 17:'Continuing'
Row 16 0:'NGC Information Operations' 1:'Option/ FFP' 2:'General Dynamics : Orlando, FL' 3:'-' 4:'-' 5:'' 6:'2.174' 7:'None' 8:'Jan 2026' 9:'2.369' 10:'Mar 2027' 11:'-' 12:'' 13:'2.369' 14:'None' 15:'Continuing' 16:'Continuing' 17:'-'
Row 17 0:'NGC Test and Integration' 1:'Option/ Various' 2:'GDMS / Palantir : Orlando, FL' 3:'-' 4:'-' 5:'' 6:'11.436' 7:'None' 8:'Mar 2026' 9:'13.990' 10:'Mar 2027' 11:'-' 12:'' 13:'13.990' 14:'None' 15:'Continuing' 16:'Continuing' 17:'-'
Row 18 0:'NGC Cloud Services (FKA Data Fabric)' 1:'IA' 2:'Enterprise Cloud Management Agency : Ft. Belvoir, VA' 3:'-' 4:'3.031' 5:'Aug 2025' 6:'6.000' 7:'None' 8:'Apr 2026' 9:'6.000' 10:'Apr 2027' 11:'-' 12:'' 13:'6.000' 14:'None' 15:'0.000' 16:'15.031' 17:'-'
Row 19 0:'' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Page 317 **********************
Row 0 0:'Exhibit R-3, RDT&E Project Cost Analysis: PB 2027 Army' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'Date: April 2026' 15:'None' 16:'None' 17:'None'
Row 1 0:'Appropriation/Budget Activity 2040 / 4' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'R-1 Program Element (Number/Name) PE 0604541A / Unified Network Transport' 8:'None' 9:'None' 10:'None' 11:'None' 12:'Project (Number/Name) BT5 / Integrated Tactical Network/Enterprise Network' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 2 0:'FY 2027 FY 2027 FY 2027 Product Development ($ in Millions) FY 2025 FY 2026 Base OOC Total' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Row 3 0:'None' 1:'None' 2:'None' 3:'None' 4:'FY 2025' 5:'None' 6:'FY 2026' 7:'None' 8:'None' 9:'FY 2027 Base' 10:'None' 11:'FY 2027 OOC' 12:'None' 13:'FY 2027 Total' 14:'None' 15:'None' 16:'None' 17:'None'
Row 4 0:'Cost Category Item' 1:'Contract Method & Type' 2:'Performing Activity & Location' 3:'Prior Years' 4:'Cost' 5:'Award Date' 6:'Cost' 7:'None' 8:'Award Date' 9:'Cost' 10:'Award Date' 11:'Cost' 12:'Award Date' 13:'Cost' 14:'None' 15:'Cost To Complete' 16:'Total Cost' 17:'Target Value of Contract'
Row 5 0:'S&T Maturation - Robust & Resilient Transport' 1:'C/CPFF' 2:'DEVCOM C5ISR / Techximius Corp : APG, MD' 3:'-' 4:'1.111' 5:'Feb 2025' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'1.111' 17:'-'
Row 6 0:'S&T Maturation - Information Trust' 1:'C/CPFF' 2:'DEVCOM C5ISR / Peraton : APG, MD / Chantilly, VA' 3:'-' 4:'0.700' 5:'Mar 2025' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'0.700' 17:'-'
Row 7 0:'S&T Maturation - Agile Versatile Enclave' 1:'C/CPFF' 2:'DEVCOM C5ISR / CACI / GD One Source : APG, MD / Chantilly, VA / Salem, NH' 3:'-' 4:'2.333' 5:'Jan 2025' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'2.333' 17:'-'
Row 8 0:'Science & Technology (S&T) Maturation Prototyping & Evaluation' 1:'C/Various' 2:'DEVCOM C5ISR / PEO C3N : APG, MD' 3:'34.093' 4:'-' 5:'' 6:'13.325' 7:'None' 8:'Dec 2025' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'47.418' 17:'-'
Row 9 0:'Industry Innovation - C5ISR Modular Open Suite of Standards (CMOSS)' 1:'C/Various' 2:'Trellisware / Spectranetix / GDMS / NGC : San Diego, CA / Sunnyvale, CA / Scottsdale, AZ' 3:'8.387' 4:'-' 5:'' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'8.387' 17:'-'
Row 10 0:'Industry Innovation - CMOSS Mounted Form Factor Chassis Software' 1:'C/CPFF' 2:'GDMS : Bloomington, MN' 3:'5.760' 4:'-' 5:'' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'5.760' 17:'-'
Row 11 0:'Industry Innovation - Next Generation Blue Force Tracker CMOSS' 1:'C/CPFF' 2:'GDMS : Scottsdale, AZ' 3:'4.961' 4:'-' 5:'' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'4.961' 17:'-'
Row 12 0:'Industry Innovation - CMFF Tactical Radio Capabilities' 1:'C/Various' 2:'Rockwell Collins : Cedar Rapids, IA' 3:'2.942' 4:'-' 5:'' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'2.942' 17:'-'
Row 13 0:'Industry Innovation - Gateway Automation' 1:'C/FFP' 2:'Palo Alto Networks : Reston, VA' 3:'1.981' 4:'-' 5:'' 6:'-' 7:'None' 8:'' 9:'-' 10:'' 11:'-' 12:'' 13:'-' 14:'None' 15:'0.000' 16:'1.981' 17:'-'
Row 14 0:'Industry Innovation - Anduril Industries : C/FFP 2.472 - - - - - 0.000 2.472 - Project Convergence - Costa Mesa, CA' 1:'None' 2:'None' 3:'None' 4:'None' 5:'None' 6:'None' 7:'None' 8:'None' 9:'None' 10:'None' 11:'None' 12:'None' 13:'None' 14:'None' 15:'None' 16:'None' 17:'None'
Environment
- pdfplumber version: 0.11.4
- Python version: 3.11.2
- OS: windows
Additional context
Add any other context/notes about the problem here.
Describe the bug
Improper parsing of a table's last row if it's at the bottom of a page and not closed.
See document cited below on pages 117,134,317 for cases resulting in bad behavior. See Table on Page 201 for good behavior.
Have you tried repairing the PDF?
I can't run the repair function on my machine because it requires a library I can't install (ghostscript).
Code to reproduce the problem
Rows with error:
PDF file
Here's an example of the PDF where it fails: Look at pages 117, 172, 317 of this DoD Budget document. https://www.asafm.army.mil/Portals/72/Documents/BudgetMaterial/2027/Discretionary%20Budget/rdte/RDTE%20-%20Vol%202%20-%20Budget%20Activity%204B.pdf
RDTE - Vol 2 - Budget Activity 4B.pdf
Expected behavior
It should have parsed the row's 18 cells into the returned array according to column (as it did with the other rows on those pages). See results for Page 201 for good behavior ==> last row in table is closed and parses correctly.
note that some table rows don't result in 18 columns which is not a problem.
Actual behavior
It puts the entire row into column 0 and puts None everywhere else. See error rows on the dump below.
Screenshots
Not Closed (page 134):

Closed Table: (page 201):
Here's the output of that code above:
Environment
Additional context
Add any other context/notes about the problem here.