Index
- Installation
- Getting Started
- Memory Usage
- Readers and Writers
- The Document Class
- Metadata
- Pages
- Canvas
- Page Layout and Mode
- Viewer Preferences
- Document Outline
- Page Labels
- Actions
- Destinations
- Annotations
- Embedded File Streams
- Colors and Color Spaces
- Page Formats and Boundaries
- Standard and Public Key Encryption
- Fonts and Encodings
- Corrupted Documents
- Reader Enabled Documents
- Refactor Old SetaPDF Code
- API Reference
Destinations
Table of Contents
Introduction
A destination in a PDF document defines a particular view of a page, the location of the document window on that page, and a zoom factor.
Destinations may be associated with outline items, annotations, or actions. They may be specified either explicitly or indirectly by a name.
The Destination Class
A destination is represented by the SetaPDF_Core_Document_Destination
class. This class offers some methods to evaluate a destination and let you resolve its target page in an easy way:
getPage()
Get the target page object.
getPageNo()
Get the target page number.
The class also comes with several static methods that let you create or find a destination by a name:
createByPage()
Creates a destination by a page object.
createByPageNo()
Creates a destination by page number.
createDestinationArray()
Creates an explicit Destination array.
findByName()
Find a destination by a name.
Examples
As a destination is related to a page the easiest way to create one is to use one of the provided helper methods: createByPage()
or createByPageNo()
. Internally both of these methods will create the needed destination array by calling the createDestinationArray()
method. All arguments passed to one of the helper methods will also be forward to this method (e.g. the fit-mode). The default fit-mode is set to "fit".
It is also possible to define the position and zoom factor of the destination by a specific fit-mode:
Explicit vs. Named Destinations
Destinations are represented in PDF by a simple array structure which can be used as a value in structures that allow a destination value. In addition it is also allowed to use named destinations which are represented by a simple string value. The destination array related to this named destination is saved in a documents name tree. This tree will be used to look-up for these named destinations. Internally the findByName()
method makes use of a documents name tree to resolve the destination appropriate.