MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / extract_text

Method extract_text

scripts/fetch_fulltext.py:69–79  ·  view source on GitHub ↗
(pdf_bytes: bytes)

Source from the content-addressed store, hash-verified

67
68 @staticmethod
69 def extract_text(pdf_bytes: bytes) -> str:
70 if fitz is None:
71 raise RuntimeError("PyMuPDF not installed")
72 doc = fitz.open(stream=pdf_bytes, filetype="pdf")
73 pages = []
74 for i, page in enumerate(doc):
75 text = page.get_text("text")
76 if text.strip():
77 pages.append(f"<!-- Page {i + 1} -->\n{text.strip()}")
78 doc.close()
79 return "\n\n---\n\n".join(pages)
80
81
82KNOWN_PDF_URLS = {

Callers 1

process_entryFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected