MCPcopy Create free account
hub / github.com/VectifyAI/PageIndex / get_text_of_pages

Function get_text_of_pages

pageindex/utils.py:236–246  ·  view source on GitHub ↗
(pdf_path, start_page, end_page, tag=True)

Source from the content-addressed store, hash-verified

234 return title
235
236def get_text_of_pages(pdf_path, start_page, end_page, tag=True):
237 pdf_reader = PyPDF2.PdfReader(pdf_path)
238 text = ""
239 for page_num in range(start_page-1, end_page):
240 page = pdf_reader.pages[page_num]
241 page_text = page.extract_text()
242 if tag:
243 text += f"<start_index_{page_num+1}>\n{page_text}\n<end_index_{page_num+1}>\n"
244 else:
245 text += page_text
246 return text
247
248def get_first_start_page_from_text(text):
249 start_page = -1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected