File size: 377 Bytes
a377365 4491ff6 a377365 4491ff6 a377365 4491ff6 a377365 4491ff6 a377365 4491ff6 a377365 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from PyPDF2 import PdfReader
# Function to extract text from PDFs (normal PDFs only)
def extract_text_from_pdf(pdf_path):
reader = PdfReader(pdf_path)
text = ""
for page in reader.pages:
text += page.extract_text()
return text.strip()
# Main function to handle PDF text extraction
def get_pdf_text(pdf_path):
return extract_text_from_pdf(pdf_path) |