MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / prev_location

Method prev_location

src/__init__.py:6104–6118  ·  view source on GitHub ↗

Get (chapter, page) of previous page.

(self, page_id)

Source from the content-addressed store, hash-verified

6102 return perm
6103
6104 def prev_location(self, page_id):
6105
6106 """Get (chapter, page) of previous page."""
6107 if self.is_closed or self.is_encrypted:
6108 raise ValueError("document closed or encrypted")
6109 if type(page_id) is int:
6110 page_id = (0, page_id)
6111 if page_id not in self:
6112 raise ValueError("page id not in document")
6113 if page_id == (0, 0):
6114 return ()
6115 chapter, pno = page_id
6116 loc = mupdf.fz_make_location(chapter, pno)
6117 prev_loc = mupdf.fz_previous_page(self.this, loc)
6118 return prev_loc.chapter, prev_loc.page
6119
6120 def reload_page(self, page: Page) -> Page:
6121 """Make a fresh copy of a page."""

Callers 1

test_pageidsFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_pageidsFunction · 0.64