The best way is to pre-process before manipulate so here I can simply convert pdftotext then call that in notepad or excel and using excel vba that could all be done without python OR for your use you can edit using python the text into csv by add the commas in the desired columns as per the way excel does it.


either way its just one line to call on multiple files.
list,of al,l pieces:,,,
,Piece,Widt x,Hei,Q,ty Description
,58,762 x,582,2,@5
,70,762 x,582,2,@5
,16,70 x,564,4,@8
,67,70 x,1250,4,@8
,59,1250 x,582,1,@5
,71,1350 x,582,1,@5
,77,762 x,582,1,@5
,28,744 x,70,1,@8
,44,194 x,70,1,@8
,84,802 x,280,3,@2
so depending on how you clean your text you can do much better than above raw single line output as we don't need excel either
@pdftotext -nopgbrk -f 1 -l 1 -layout -x 290 -y 530 -W 300 -H 300 cut-sample.pdf out.txt
@echo Pc,W,H,Q,C>out.csv&for /f "usebackq tokens=1,2,4,5,6 delims= " %%f in ("out.txt") do @echo %%f,%%g,%%h,%%i,%%j >>out.csv
@echo/&type out.csv

Here I have not allowed for different size or positions of tables so, if necessary, you can move that "window" of interest up and to left and wider and taller then simply extract any line that includes @
as those are always in this OP example.
For a more complex "if this then that" CSV output see https://stackoverflow.com/a/75856112/10802527