retrieve annot by its xref
(page, xref)
| 19595 | |
| 19596 | |
| 19597 | def 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 | |
| 19617 | def JM_get_annot_by_name(page, name): |
no outgoing calls
no test coverage detected
searching dependent graphs…