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

Method page_xref

src/__init__.py:5991–6006  ·  view source on GitHub ↗

Get xref of page number.

(self, pno)

Source from the content-addressed store, hash-verified

5989 return page_n
5990
5991 def page_xref(self, pno):
5992 """Get xref of page number."""
5993 if g_use_extra:
5994 return extra.page_xref( self.this, pno)
5995 if self.is_closed:
5996 raise ValueError("document closed")
5997 page_count = mupdf.fz_count_pages(self.this)
5998 n = pno
5999 while n < 0:
6000 n += page_count
6001 pdf = _as_pdf_document(self)
6002 xref = 0
6003 if n >= page_count:
6004 raise ValueError( MSG_BAD_PAGENO)
6005 xref = mupdf.pdf_to_num(mupdf.pdf_lookup_page_obj(pdf, n))
6006 return xref
6007
6008 @property
6009 def pagelayout(self) -> str:

Callers 13

resolve_namesMethod · 0.95
showFunction · 0.80
getLinkTextFunction · 0.80
_do_linksMethod · 0.80
set_tocMethod · 0.80
set_toc_itemMethod · 0.80
xrefMethod · 0.80
xrefMethod · 0.80
showFunction · 0.80
set_toc_itemFunction · 0.80
set_tocFunction · 0.80
do_linksFunction · 0.80

Calls 1

_as_pdf_documentFunction · 0.85

Tested by

no test coverage detected