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

Method set_mediabox

src/__init__.py:12959–12972  ·  view source on GitHub ↗

Set the MediaBox.

(self, rect)

Source from the content-addressed store, hash-verified

12957 )
12958
12959 def set_mediabox(self, rect):
12960 """Set the MediaBox."""
12961 CheckParent(self)
12962 page = self._pdf_page()
12963 mediabox = JM_rect_from_py(rect)
12964 if (mupdf.fz_is_empty_rect(mediabox)
12965 or mupdf.fz_is_infinite_rect(mediabox)
12966 ):
12967 raise ValueError( MSG_BAD_RECT)
12968 mupdf.pdf_dict_put_rect( page.obj(), PDF_NAME('MediaBox'), mediabox)
12969 mupdf.pdf_dict_del( page.obj(), PDF_NAME('CropBox'))
12970 mupdf.pdf_dict_del( page.obj(), PDF_NAME('ArtBox'))
12971 mupdf.pdf_dict_del( page.obj(), PDF_NAME('BleedBox'))
12972 mupdf.pdf_dict_del( page.obj(), PDF_NAME('TrimBox'))
12973
12974 def set_rotation(self, rotation):
12975 """Set page rotation."""

Callers 3

remove_rotationMethod · 0.95
page_rotation_set0Function · 0.80
page_rotation_resetFunction · 0.80

Calls 4

_pdf_pageMethod · 0.95
CheckParentFunction · 0.85
JM_rect_from_pyFunction · 0.85
PDF_NAMEFunction · 0.85

Tested by

no test coverage detected