MCPcopy Create free account
hub / github.com/daniel2005d/mapXplore / _read_pdf

Method _read_pdf

lib/file_reader.py:41–50  ·  view source on GitHub ↗
(self, content:bytearray, max_pages=2)

Source from the content-addressed store, hash-verified

39 return None
40
41 def _read_pdf(self, content:bytearray, max_pages=2)->str:
42 text = ""
43 pdf = io.BytesIO(content)
44 reader = PdfReader(pdf)
45 total_pages = len(reader.pages)
46 pages = min(total_pages, max_pages)
47 for page in reader.pages:
48 text+=page.extract_text()+'\n'
49
50 return text
51
52 def _read_word(self, zip_file, document_name)->str:
53 text=""

Callers 1

get_from_base64Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected