def extract_text_from_pdf(pdf): pdf_Text = "" reader = PdfReader(pdf) for page_num in range(len(reader.pages)): page = reader.pages[page_num] text = page.extract_text() pdf_Text += text + "\n" print("Extracted Text:\n", pdf_Text) # Add this line to debug return pdf_Text