fixed with example data
This commit is contained in:
1 parent
5fb1a855a1
commit
d28cccc957
16 files changed
+797
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to examine the raw text extraction from failing PDFs.
|
||||
"""
|
||||
|
||||
from PyPDF2 import PdfReader
|
||||
import os
|
||||
|
||||
# Test the first failing PDF
|
||||
pdf_path = '134d5916-1c71-47da-a24c-0ead74f8f8e2.pdf'
|
||||
|
||||
if os.path.exists(pdf_path):
|
||||
reader = PdfReader(pdf_path)
|
||||
if len(reader.pages) > 0:
|
||||
text = reader.pages[0].extract_text()
|
||||
print(f"Raw text from {pdf_path}:")
|
||||
print(repr(text))
|
||||
print("\nFormatted text:")
|
||||
print(text)
|
||||
print("\nLines:")
|
||||
for i, line in enumerate(text.split('\n')):
|
||||
print(f"{i+1}: {repr(line)}")
|
||||
else:
|
||||
print(f"PDF file {pdf_path} not found")
|
||||
Reference in new issue
Block a user