PTDestination

@interface PTDestination : NSObject

A destination defines a particular view of a document, consisting of the following:

  • The page of the document to be displayed
  • The location of the document window on that page
  • The magnification (zoom) factor to use when displaying the page

Destinations may be associated with Bookmarks, Annotations, and Remote Go-To Actions.

Destination is a utility class used to simplify work with PDF Destinations; Please refer to section 8.2.1 ‘Destinations’ in PDF Reference Manual for details.

  • Create a new ‘XYZ’ Destination.

    The new Destination displays the page designated by ‘page’, with the coordinates (‘left’, ‘top’) positioned at the top-left corner of the window and the contents of the page magnified by the factor ‘zoom’. A null value for any of the parameters ‘left’, ‘top’, or ‘zoom’ specifies that the current value of that parameter is to be retained unchanged. A ‘zoom’ value of 0 has the same meaning as a null value. the page within the window in the other dimension.

    Declaration

    Objective-C

    + (PTDestination *)CreateXYZ:(PTPage *)page
                            left:(double)left
                             top:(double)top
                            zoom:(double)zoom;

    Swift

    class func createXYZ(_ page: PTPage!, left: Double, top: Double, zoom: Double) -> PTDestination!

    Parameters

    page

    Page object to display

    left

    horizontal coordinate of the left edge of the window

    top

    vertical coordinate of the top edge of the window

    zoom

    amount to zoom the page by

  • Create a new ‘Fit’ Destination.

    The new Destination displays the page designated by ‘page’, with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension.

    Declaration

    Objective-C

    + (PTDestination *)CreateFit:(PTPage *)page;

    Swift

    class func createFit(_ page: PTPage!) -> PTDestination!

    Parameters

    page

    Page object to display

  • Create a new ‘FitH’ Destination.

    The new Destination displays the page designated by ‘page’, with the vertical coordinate ‘top’ positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window.

    Declaration

    Objective-C

    + (PTDestination *)CreateFitH:(PTPage *)page top:(double)top;

    Swift

    class func createFitH(_ page: PTPage!, top: Double) -> PTDestination!

    Parameters

    page

    Page object to display

    top

    vertical coordinate of the top edge of the window

  • Create a new ‘FitV’ Destination.

    The new Destination displays the page designated by ‘page’, with the horizontal coordinate ‘left’ positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window.

    Declaration

    Objective-C

    + (PTDestination *)CreateFitV:(PTPage *)page left:(double)left;

    Swift

    class func createFitV(_ page: PTPage!, left: Double) -> PTDestination!

    Parameters

    page

    Page object to display

    left

    horizontal coordinate of the left edge of the window

  • Create a new ‘FitR’ Destination.

    The new Destination displays the page designated by ‘page’, with its contents magnified just enough to fit the rectangle specified by the coordinates ‘left’, ‘bottom’, ‘right’, and ‘top’ entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension.

    Declaration

    Objective-C

    + (PTDestination *)CreateFitR:(PTPage *)page
                             left:(double)left
                           bottom:(double)bottom
                            right:(double)right
                              top:(double)top;

    Swift

    class func createFitR(_ page: PTPage!, left: Double, bottom: Double, right: Double, top: Double) -> PTDestination!

    Parameters

    page

    Page object to display

    left

    horizontal coordinate of the left edge of the window

    bottom

    vertical coordinate of the bottom edge of the window

    right

    horizontal coordinate of the right edge of the window

    top

    vertical coordinate of the top edge of the window

  • Create a new ‘FitB’ Destination.

    The new Destination displays the page designated by ‘page’, with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension.

    Declaration

    Objective-C

    + (PTDestination *)CreateFitB:(PTPage *)page;

    Swift

    class func createFitB(_ page: PTPage!) -> PTDestination!

    Parameters

    page

    Page object to display

  • Create a new ‘FitBH’ Destination.

    The new Destination displays the page designated by ‘page’, with the vertical coordinate ‘top’ positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window.

    Declaration

    Objective-C

    + (PTDestination *)CreateFitBH:(PTPage *)page top:(double)top;

    Swift

    class func createFitBH(_ page: PTPage!, top: Double) -> PTDestination!

    Parameters

    page

    Page object to display

    top

    vertical coordinate of the top edge of the window

  • Create a new ‘FitBV’ Destination.

    The new Destination displays Display the page designated by ‘page’, with the horizontal coordinate ‘left’ positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window.

    Declaration

    Objective-C

    + (PTDestination *)CreateFitBV:(PTPage *)page left:(double)left;

    Swift

    class func createFitBV(_ page: PTPage!, left: Double) -> PTDestination!

    Parameters

    page

    Page object to display

    left

    horizontal coordinate of the left edge of the window

  • Create a Destination and initialize it using given Cos/SDF object.

    Note

    The constructor does not copy any data, but is instead the logical equivalent of a type cast.

    Note

    Named destinations (in case ‘dest’ is a Name or a String) are automatically resolved to the explicit destination. If the name can’t be resolved to the explicit destination dest.IsValid() will return false.

    Declaration

    Objective-C

    - (instancetype)initWithDest:(PTObj *)dest;

    Swift

    init!(dest: PTObj!)

    Parameters

    dest

    - a low-level (SDF/Cos) destination object. The low-level destination can be either a named destination (i.e. a Name or a String) or an explicit destination (i.e. an Array Obj). Please refer to section 8.2.1 ‘Destinations’ in PDF Reference Manual for more details.

  • Note

    If this method returns false the underlying SDF/Cos object is null and the Action object should be treated as null as well.

    Declaration

    Objective-C

    - (BOOL)IsValid;

    Swift

    func isValid() -> Bool

    Return Value

    True if this is a valid Destination and can be resolved, false otherwise.

  • Declaration

    Objective-C

    - (PTFitType)GetFitType;

    Swift

    func getFitType() -> PTFitType

    Return Value

    destination’s FitType. @exception An Exception is thrown if this is not a valid Destination.

  • Declaration

    Objective-C

    - (PTPage *)GetPage;

    Swift

    func getPage() -> PTPage!

    Return Value

    the Page that this destination refers to. @exception An Exception is thrown if this is not a valid Destination.

  • Modify the destination so that it refers to the new ‘page’ as the destination page.

    Declaration

    Objective-C

    - (void)SetPage:(PTPage *)page;

    Swift

    func setPage(_ page: PTPage!)

    Parameters

    page

    The new page associated with this Destination. @exception An Exception is thrown if this is not a valid Destination.

  • Declaration

    Objective-C

    - (PTObj *)GetSDFObj;

    Swift

    func getSDFObj() -> PTObj!

    Return Value

    the object to the underlying SDF/Cos object. The returned SDF/Cos object is an explicit destination (i.e. the Obj is either an array defining the destination, using the syntax shown in Table 8.2 in PDF Reference Manual), or a dictionary with a ‘D’ entry whose value is such an array. The latter form allows additional attributes to be associated with the destination

  • @exception An Exception is thrown if this is not a valid Destination.

    Declaration

    Objective-C

    - (PTObj *)GetExplicitDestObj;

    Swift

    func getExplicitDestObj() -> PTObj!

    Return Value

    the explicit destination SDF/Cos object. This is always an Array as shown in Table 8.2 in PDF Reference Manual.