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

Method set_rect

src/__init__.py:1529–1543  ·  view source on GitHub ↗

Set annotation rectangle.

(self, rect)

Source from the content-addressed store, hash-verified

1527 mupdf.pdf_set_annot_popup(annot, r)
1528
1529 def set_rect(self, rect):
1530 """Set annotation rectangle."""
1531 CheckParent(self)
1532 annot = self.this
1533
1534 pdfpage = _pdf_annot_page(annot)
1535 rot = JM_rotate_page_matrix(pdfpage)
1536 r = mupdf.fz_transform_rect(JM_rect_from_py(rect), rot)
1537 if mupdf.fz_is_empty_rect(r) or mupdf.fz_is_infinite_rect(r):
1538 raise ValueError( MSG_BAD_RECT)
1539 try:
1540 mupdf.pdf_set_annot_rect(annot, r)
1541 except Exception as e:
1542 message(f'cannot set rect: {e}')
1543 return False
1544
1545 def set_rotation(self, rotate=0):
1546 """Set annotation rotation."""

Callers 2

updateMethod · 0.95
remove_rotationMethod · 0.45

Calls 5

CheckParentFunction · 0.85
_pdf_annot_pageFunction · 0.85
JM_rotate_page_matrixFunction · 0.85
JM_rect_from_pyFunction · 0.85
messageFunction · 0.70

Tested by

no test coverage detected