After test thousands of files, we 7Zip a bunch of files for which extract_text fails at specific pages
Environment
$ python -m platform
Windows-10-10.0.22000-SP0
$ python -c "import PyPDF2;print(PyPDF2.__version__)"
2.6.0 #main
Code + PDF
This is a minimal, complete example that shows the issue:
import csv
with open("extract_text_error.csv", "rt",encoding='utf-8') as csvfile:
reader = csv.reader(csvfile)
filelist = [row[0] for row in reader]
filelist=list(set(filelist))
# for prepare a minimal reproducible version
# just reuse the extract_text_error.csv file to get a filelist
######################
### IMPORTANT: remember to change the absolute path of filelist
for path_pdf_name in filelist:
pdfReader=PyPDF2.PdfReader(path_pdf_name)
text=""
for i,page in enumerate(pdfReader.pages):
try:
text+=page.extract_text()
except:
with open("extract_text_error1.csv","a",encoding='utf-8') as file:
file.write('%s,%s\n' % (path_pdf_name,i))
continue
pdf zip sharing: https://drive.google.com/file/d/1Ado46PEN_GYUhSI0zlSujX0722FAgk27/view?usp=sharing
extract_text_error.csv
The reason why this file is not continuous with file name is because that locally I extract them with multiprocessing.
After test thousands of files, we 7Zip a bunch of files for which extract_text fails at specific pages
Environment
Code + PDF
This is a minimal, complete example that shows the issue:
pdf zip sharing: https://drive.google.com/file/d/1Ado46PEN_GYUhSI0zlSujX0722FAgk27/view?usp=sharing
extract_text_error.csv
The reason why this file is not continuous with file name is because that locally I extract them with multiprocessing.