Generator over the annotations of a page. Args: types: (list) annotation types to subselect from. If none, all annotations are returned. E.g. types=[PDF_ANNOT_LINE] will only yield line annotations.
(self, types=None)
| 10639 | return JM_get_annot_xref_list2(self) |
| 10640 | |
| 10641 | def annots(self, types=None): |
| 10642 | """ Generator over the annotations of a page. |
| 10643 | |
| 10644 | Args: |
| 10645 | types: (list) annotation types to subselect from. If none, |
| 10646 | all annotations are returned. E.g. types=[PDF_ANNOT_LINE] |
| 10647 | will only yield line annotations. |
| 10648 | """ |
| 10649 | skip_types = (mupdf.PDF_ANNOT_LINK, mupdf.PDF_ANNOT_POPUP, mupdf.PDF_ANNOT_WIDGET) |
| 10650 | if not hasattr(types, "__getitem__"): |
| 10651 | annot_xrefs = [a[0] for a in self.annot_xrefs() if a[1] not in skip_types] |
| 10652 | else: |
| 10653 | annot_xrefs = [a[0] for a in self.annot_xrefs() if a[1] in types and a[1] not in skip_types] |
| 10654 | for xref in annot_xrefs: |
| 10655 | annot = self.load_annot(xref) |
| 10656 | annot._yielded=True |
| 10657 | yield annot |
| 10658 | |
| 10659 | def apply_redactions( |
| 10660 | page: 'Page', |