MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / load_page

Method load_page

src/__init__.py:5749–5777  ·  view source on GitHub ↗

Load a page. 'page_id' is either a 0-based page number or a tuple (chapter, pno), with chapter number and page number within that chapter.

(self, page_id)

Source from the content-addressed store, hash-verified

5747 self.init_doc()
5748
5749 def load_page(self, page_id):
5750 """Load a page.
5751
5752 'page_id' is either a 0-based page number or a tuple (chapter, pno),
5753 with chapter number and page number within that chapter.
5754 """
5755 if self.is_closed or self.is_encrypted:
5756 raise ValueError("document closed or encrypted")
5757 if page_id is None:
5758 page_id = 0
5759 if page_id not in self:
5760 raise ValueError("page not in document")
5761 if type(page_id) is int and page_id < 0:
5762 np = self.page_count
5763 while page_id < 0:
5764 page_id += np
5765 if isinstance(page_id, int):
5766 page = mupdf.fz_load_page(self.this, page_id)
5767 else:
5768 chapter, pagenum = page_id
5769 page = mupdf.fz_load_chapter_page(self.this, chapter, pagenum)
5770 val = Page(page, self)
5771
5772 val.thisown = True
5773 val.parent = self
5774 self._page_refs[id(val)] = val
5775 val._annot_refs = weakref.WeakValueDictionary()
5776 val.number = page_id
5777 return val
5778
5779 def location_from_page_number(self, pno):
5780 """Convert pno to (chapter, page)."""

Callers 15

full_ocrFunction · 0.95
get_textpage_ocrFunction · 0.95
__getitem__Method · 0.95
pagesMethod · 0.95
reload_pageMethod · 0.95
recolorMethod · 0.95
full_ocrFunction · 0.95
get_textpage_ocrFunction · 0.95
get_widgets_by_nameFunction · 0.80
test_3848Function · 0.80
test_4388Function · 0.80
test_2238Function · 0.80

Calls 1

PageClass · 0.85

Tested by 7

get_widgets_by_nameFunction · 0.64
test_3848Function · 0.64
test_4388Function · 0.64
test_2238Function · 0.64
test_2093Function · 0.64
test_2710Function · 0.64
test_4712Function · 0.64