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

Method page_number_from_location

src/__init__.py:5977–5989  ·  view source on GitHub ↗

Convert (chapter, pno) to page number.

(self, page_id)

Source from the content-addressed store, hash-verified

5975 return val
5976
5977 def page_number_from_location(self, page_id):
5978 """Convert (chapter, pno) to page number."""
5979 if type(page_id) is int:
5980 np = self.page_count
5981 while page_id < 0:
5982 page_id += np
5983 page_id = (0, page_id)
5984 if page_id not in self:
5985 raise ValueError("page id not in document")
5986 chapter, pno = page_id
5987 loc = mupdf.fz_make_location( chapter, pno)
5988 page_n = mupdf.fz_page_number_from_location( self.this, loc)
5989 return page_n
5990
5991 def page_xref(self, pno):
5992 """Get xref of page number."""

Callers 1

test_pageidsFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_pageidsFunction · 0.64