Spaces:
Sleeping
Sleeping
File size: 375 Bytes
4cccee3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import fitz # PyMuPDF
def extract_text_from_pdf(pdf_path: str) -> str:
text = ""
try:
with fitz.open(pdf_path) as doc:
for page in doc:
text += page.get_text()
return text.replace("\n", " ").replace(" ", " ").strip()
except Exception as e:
print(f"PDF Extraction Error: {e}")
return ""
|