ResumeIQ / utils /pdf_utils.py
pranav8tripathi's picture
Upload 28 files (#2)
6f62c71 verified
raw
history blame contribute delete
399 Bytes
# utils/pdf_utils.py
import PyPDF2
def extract_text_from_pdf(uploaded_file):
try:
reader = PyPDF2.PdfReader(uploaded_file)
resume_text = " ".join(
[page.extract_text() for page in reader.pages if page.extract_text()]
)
return resume_text.strip()
except Exception as e:
raise RuntimeError(f"Failed to extract PDF text: {e}")