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

Function JM_get_annot_by_xref

src/__init__.py:19597–19614  ·  view source on GitHub ↗

retrieve annot by its xref

(page, xref)

Source from the content-addressed store, hash-verified

19595
19596
19597def JM_get_annot_by_xref(page, xref):
19598 '''
19599 retrieve annot by its xref
19600 '''
19601 assert isinstance(page, mupdf.PdfPage)
19602 found = 0
19603 # loop thru MuPDF's internal annots array
19604 annot = mupdf.pdf_first_annot(page)
19605 while 1:
19606 if not annot.m_internal:
19607 break
19608 if xref == mupdf.pdf_to_num(mupdf.pdf_annot_obj(annot)):
19609 found = 1
19610 break
19611 annot = mupdf.pdf_next_annot( annot)
19612 if not found:
19613 raise Exception(f"xref {xref:d} is not an annot of this page")
19614 return annot
19615
19616
19617def JM_get_annot_by_name(page, name):

Callers 1

_load_annotMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…