File size: 382 Bytes
e4a6d2a
4491ff6
 
e4a6d2a
 
 
4491ff6
e4a6d2a
 
 
 
4491ff6
 
 
a377365
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import fitz  # PyMuPDF

def extract_text_from_pdf(pdf_path):
    """
    Extracts text from PDF using PyMuPDF (fitz).
    """
    text = ""
    with fitz.open(pdf_path) as pdf:
        for page_num in range(len(pdf)):
            page = pdf[page_num]
            text += page.get_text()
    return text.strip()

def get_pdf_text(pdf_path):
    return extract_text_from_pdf(pdf_path)