Download hfd_iclr2027_draft/tools/python/pypdf/generic/_outline.py from Tinghong-Ye22/code-iclr: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/Tinghong-Ye22/code-iclr/resolve/main/hfd_iclr2027_draft/tools/python/pypdf/generic/_outline.py
- Command line
-
hf download hf://Tinghong-Ye22/code-iclr/hfd_iclr2027_draft/tools/python/pypdf/generic/_outline.py
-
curl -L -o _outline.py https://huggingface.co/Tinghong-Ye22/code-iclr/resolve/main/hfd_iclr2027_draft/tools/python/pypdf/generic/_outline.py
1.09 kB
| from typing import Union | |
| from .._utils import StreamType, deprecation_no_replacement | |
| from ._base import NameObject | |
| from ._data_structures import Destination | |
| class OutlineItem(Destination): | |
| def write_to_stream( | |
| self, stream: StreamType, encryption_key: Union[str, bytes, None] = None | |
| ) -> None: | |
| if encryption_key is not None: # deprecated | |
| deprecation_no_replacement( | |
| "the encryption_key parameter of write_to_stream", "5.0.0" | |
| ) | |
| stream.write(b"<<\n") | |
| for key in [ | |
| NameObject(x) | |
| for x in ["/Title", "/Parent", "/First", "/Last", "/Next", "/Prev"] | |
| if x in self | |
| ]: | |
| key.write_to_stream(stream) | |
| stream.write(b" ") | |
| value = self.raw_get(key) | |
| value.write_to_stream(stream) | |
| stream.write(b"\n") | |
| key = NameObject("/Dest") | |
| key.write_to_stream(stream) | |
| stream.write(b" ") | |
| value = self.dest_array | |
| value.write_to_stream(stream) | |
| stream.write(b"\n") | |
| stream.write(b">>") | |