pdftools_toolbox.pdf.navigation.fit_height_destination
Classes
|
A destination fits the height of a page into the viewport. |
- class pdftools_toolbox.pdf.navigation.fit_height_destination.FitHeightDestination(handle)[source]
Bases:
DirectDestinationA destination fits the height of a page into the viewport.
Note: Many PDF viewers support different viewing modes like “fit page” or “fit width”. A
pdftools_toolbox.pdf.navigation.fit_height_destination.FitHeightDestinationwill change the current viewing mode to “fit height” in those viewers.Changing the viewing mode is usually not very well received by users and thus a
pdftools_toolbox.pdf.navigation.location_zoom_destination.LocationZoomDestinationshould be preferred in most cases.- static create(target_document: Document, page: Page, fit_actual_content: bool, left: float | None = None) → FitHeightDestination[source]
Create a new FitHeightDestination
The returned object is not yet used on any page, but it is associated with the given target document.
- Parameters:
targetDocument (pdftools_toolbox.pdf.document.Document) – The output document with which the returned object is associated
page (pdftools_toolbox.pdf.page.Page) – The page in the document that this destination is pointing to.
fitActualContent (bool) –
If True, the viewport is fitted to the actual content of the page, instead of the size of the page.
See property
pdftools_toolbox.pdf.navigation.fit_height_destination.FitHeightDestination.fit_actual_contentfor more information.left (Optional[float]) –
The location of the page that is displayed at the left border of the viewport or None.
See property
pdftools_toolbox.pdf.navigation.fit_height_destination.FitHeightDestination.leftfor more information.
- Returns:
The newly created destination object.
- Return type:
pdftools_toolbox.pdf.navigation.fit_height_destination.FitHeightDestination
- Raises:
ValueError – if the targetDocument argument has already been closed
ValueError – if the targetDocument argument is read-only
ValueError – if the targetDocument`differs from the document associated with `page
ValueError – If the document associated with the page argument has already been closed
- property fit_actual_content: bool
If True, the viewport is fitted to the width of the actual content of the page, instead of the width of the page.
Note: Many PDF viewers simply ignore this property and always treat it as False, i.e. switching to “fit page” mode anyway.
- Returns:
bool
- Raises:
StateError – the object has already been closed.
StateError – the associated document has already been closed.
- property left: float | None
The location of the page that is displayed at the left border of the viewport (if possible).
If the property is None, the value from before the jump is retained.
Note: Due to the current zoom factor, it is usually not possible for viewers to scroll as far to the right side, as would be necessary to place the location at the left corner of the viewport. However, viewers will ensure, that the location is at least visible.
In practice this means, that this value is mostly irrelevant.
- Returns:
Optional[float]
- Raises:
StateError – the object has already been closed.
StateError – the associated document has already been closed.