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

Method next_location

src/__init__.py:5906–5925  ·  view source on GitHub ↗

Get (chapter, page) of next page.

(self, page_id)

Source from the content-addressed store, hash-verified

5904 return doc[pno]
5905
5906 def next_location(self, page_id):
5907 """Get (chapter, page) of next page."""
5908 if self.is_closed or self.is_encrypted:
5909 raise ValueError("document closed or encrypted")
5910 if type(page_id) is int:
5911 page_id = (0, page_id)
5912 if page_id not in self:
5913 raise ValueError("page id not in document")
5914 if tuple(page_id) == self.last_location:
5915 return ()
5916 this_doc = _as_fz_document(self)
5917 val = page_id[ 0]
5918 if not isinstance(val, int):
5919 RAISEPY(MSG_BAD_PAGEID, PyExc_ValueError)
5920 chapter = val
5921 val = page_id[ 1]
5922 pno = val
5923 loc = mupdf.fz_make_location(chapter, pno)
5924 next_loc = mupdf.fz_next_page( this_doc, loc)
5925 return next_loc.chapter, next_loc.page
5926
5927 def page_annot_xrefs(self, n):
5928 if g_use_extra:

Callers 1

test_pageidsFunction · 0.80

Calls 2

_as_fz_documentFunction · 0.85
RAISEPYFunction · 0.85

Tested by 1

test_pageidsFunction · 0.64