PDF extraction returning empty text — PyPDF2 issue
Začal/a Michael Torres · pred 3 mesiacmi
J
James Wilson
pred 4 mesiacmi
Scanned PDFs are images, not text. PyPDF2 can only extract text layers. You need OCR — try pytesseract with Pillow:\n\n```python\nfrom PIL import Image\nimport pytesseract\n\ntext = pytesseract.image_to_string(Image.open("scanned_page.png"))\n```
M
Michael Torres
pred 4 mesiacmi
I'm using PyPDF2 to extract text from scanned PDFs but getting empty strings. The file definitely has text visible when opened in a reader.
L
Lisa Nakamura
pred 3 mesiacmi
If the PDF has mixed content (some pages scanned, some digital), check each page: if extract_text() returns empty, fall back to OCR for that page.
Prihláste sa pre odpoveď na túto tému.