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

Method page_cropbox

src/__init__.py:5957–5975  ·  view source on GitHub ↗

Get CropBox of page number (without loading page).

(self, pno)

Source from the content-addressed store, hash-verified

5955 return mupdf.pdf_count_pages( self.this)
5956
5957 def page_cropbox(self, pno):
5958 """Get CropBox of page number (without loading page)."""
5959 if self.is_closed:
5960 raise ValueError("document closed")
5961 this_doc = self.this
5962 page_count = mupdf.fz_count_pages( this_doc)
5963 n = pno
5964 while n < 0:
5965 n += page_count
5966 pdf = _as_pdf_document(self)
5967 if n >= page_count:
5968 raise ValueError( MSG_BAD_PAGENO)
5969 pageref = mupdf.pdf_lookup_page_obj( pdf, n)
5970 cropbox = JM_cropbox(pageref)
5971 val = JM_py_from_rect(cropbox)
5972
5973 val = Rect(val)
5974
5975 return val
5976
5977 def page_number_from_location(self, page_id):
5978 """Convert (chapter, pno) to page number."""

Callers 4

set_tocMethod · 0.80
set_toc_itemMethod · 0.80
set_toc_itemFunction · 0.80
set_tocFunction · 0.80

Calls 4

_as_pdf_documentFunction · 0.85
JM_cropboxFunction · 0.85
JM_py_from_rectFunction · 0.85
RectClass · 0.85

Tested by

no test coverage detected