The Destination Class

class PyPDF2.generic.Destination(title: str, page: Union[PyPDF2.generic._base.NumberObject, PyPDF2.generic._base.IndirectObject, PyPDF2.generic._base.NullObject, PyPDF2.generic._data_structures.DictionaryObject], typ: Union[str, PyPDF2.generic._base.NumberObject], *args: Any)[source]

Bases: PyPDF2.generic._data_structures.TreeObject

A class representing a destination within a PDF file. See section 8.2.1 of the PDF 1.6 reference.

Parameters
  • title (str) – Title of this destination.

  • page (IndirectObject) – Reference to the page of this destination. Should be an instance of IndirectObject.

  • typ (str) – How the destination is displayed.

  • args – Additional arguments may be necessary depending on the type.

Raises

PdfReadError – If destination type is invalid.

Valid typ arguments (see PDF spec for details)

/Fit

No additional arguments

/XYZ

[left] [top] [zoomFactor]

/FitH

[top]

/FitV

[left]

/FitR

[left] [bottom] [right] [top]

/FitB

No additional arguments

/FitBH

[top]

/FitBV

[left]

property bottom: Optional[PyPDF2.generic._base.FloatObject]

Read-only property accessing the bottom vertical coordinate.

property color: Optional[PyPDF2.generic._data_structures.ArrayObject]

Read-only property accessing the color in (R, G, B) with values 0.0-1.0

property dest_array: PyPDF2.generic._data_structures.ArrayObject
property font_format: Optional[PyPDF2.constants.OutlineFontFlag]

Read-only property accessing the font type. 1=italic, 2=bold, 3=both

getDestArray() PyPDF2.generic._data_structures.ArrayObject[source]

Deprecated since version 1.28.3: Use dest_array instead.

property left: Optional[PyPDF2.generic._base.FloatObject]

Read-only property accessing the left horizontal coordinate.

property outline_count: Optional[int]

Read-only property accessing the outline count. positive = expanded negative = collapsed absolute value = number of visible descendents at all levels

property page: Optional[int]

Read-only property accessing the destination page number.

property right: Optional[PyPDF2.generic._base.FloatObject]

Read-only property accessing the right horizontal coordinate.

property title: Optional[str]

Read-only property accessing the destination title.

property top: Optional[PyPDF2.generic._base.FloatObject]

Read-only property accessing the top vertical coordinate.

property typ: Optional[str]

Read-only property accessing the destination type.

write_to_stream(stream: Union[_io.BytesIO, _io.BufferedReader, _io.BufferedWriter, _io.FileIO], encryption_key: Union[None, str, bytes]) None[source]
property zoom: Optional[int]

Read-only property accessing the zoom factor.