pdf / ingest /pdf_reader.py
haresh15's picture
Upload 32 files
eef90c7 verified
Raw History Blame Contribute Delete
436 Bytes
import pdfplumber
def extract_text(pdf_path):
chunks = []
with pdfplumber.open(pdf_path) as pdf:
for page_num, page in enumerate(pdf.pages, start=1):
text = page.extract_text() or ""
if text.strip():
chunks.append({
"page": page_num,
"type": "text",
"content": text
})
return chunks