Load an annot by name (/NM key) or xref. Args: ident: identifier, either name (str) or xref (int).
(self, ident: typing.Union[str, int])
| 12711 | yield (link) |
| 12712 | |
| 12713 | def load_annot(self, ident: typing.Union[str, int]) -> Annot: |
| 12714 | """Load an annot by name (/NM key) or xref. |
| 12715 | |
| 12716 | Args: |
| 12717 | ident: identifier, either name (str) or xref (int). |
| 12718 | """ |
| 12719 | CheckParent(self) |
| 12720 | if type(ident) is str: |
| 12721 | xref = 0 |
| 12722 | name = ident |
| 12723 | elif type(ident) is int: |
| 12724 | xref = ident |
| 12725 | name = None |
| 12726 | else: |
| 12727 | raise ValueError("identifier must be a string or integer") |
| 12728 | val = self._load_annot(name, xref) |
| 12729 | if not val: |
| 12730 | return val |
| 12731 | val.thisown = True |
| 12732 | val.parent = weakref.proxy(self) |
| 12733 | self._annot_refs[id(val)] = val |
| 12734 | return val |
| 12735 | |
| 12736 | def load_links(self): |
| 12737 | """Get first Link.""" |