Generator over the widgets of a page. Args: types: (list) field types to subselect from. If none, all fields are returned. E.g. types=[PDF_WIDGET_TYPE_TEXT] will only yield text fields.
(self, types=None)
| 13144 | page.parent.update_object(lnk["xref"], annot, page=page) |
| 13145 | |
| 13146 | def widgets(self, types=None): |
| 13147 | """ Generator over the widgets of a page. |
| 13148 | |
| 13149 | Args: |
| 13150 | types: (list) field types to subselect from. If none, |
| 13151 | all fields are returned. E.g. types=[PDF_WIDGET_TYPE_TEXT] |
| 13152 | will only yield text fields. |
| 13153 | """ |
| 13154 | #for a in self.annot_xrefs(): |
| 13155 | # log( '{a=}') |
| 13156 | widget_xrefs = [a[0] for a in self.annot_xrefs() if a[1] == mupdf.PDF_ANNOT_WIDGET] |
| 13157 | #log(f'widgets(): {widget_xrefs=}') |
| 13158 | for xref in widget_xrefs: |
| 13159 | widget = self.load_widget(xref) |
| 13160 | if types is None or widget.field_type in types: |
| 13161 | yield (widget) |
| 13162 | |
| 13163 | def wrap_contents(self): |
| 13164 | """Ensure page is in a balanced graphics state.""" |