File size: 421 Bytes
cc6cee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pypdf
import re

def parse_resume(file_path: str):
    text = ""
    try:
        reader = pypdf.PdfReader(file_path)
        for page in reader.pages:
            text += page.extract_text() + "\n"
        
        # Basic cleaning
        text = re.sub(r'\s+', ' ', text).strip()
        
    except Exception as e:
        print(f"Error reading PDF: {e}")
        return str(e)
    return text