Class: Destination

PDFNet. Destination


new Destination()

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.

Methods


<static> create(dest)

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

Parameters:
Name Type Description
dest PDFNet.Obj

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.

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFit(page)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFitB(page)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFitBH(page, top)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

top number

vertical coordinate of the top edge of the window

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFitBV(page, left)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

left number

horizontal coordinate of the left edge of the window

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFitH(page, top)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

top number

vertical coordinate of the top edge of the window

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFitR(page, left, bottom, right, top)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

left number

horizontal coordinate of the left edge of the window

bottom number

vertical coordinate of the bottom edge of the window

right number

horizontal coordinate of the right edge of the window

top number

vertical coordinate of the top edge of the window

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createFitV(page, left)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

left number

horizontal coordinate of the left edge of the window

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

<static> createXYZ(page, left, top, zoom)

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.

Parameters:
Name Type Description
page PDFNet.Page

Page object to display

left number

horizontal coordinate of the left edge of the window

top number

vertical coordinate of the top edge of the window

zoom number

amount to zoom the page by

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

copy()

Assignment operator

Returns:

A promise that resolves to an object of type: "Destination"

Type
PDFNet.Destination

getExplicitDestObj()

Returns:

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

Type
PDFNet.Obj

getFitType()

Returns:

A promise that resolves to destination's FitType.

Type
number
Example
Return value enum:
<pre>
PDFNet.Destination.FitType = {
	e_XYZ : 0
	e_Fit : 1
	e_FitH : 2
	e_FitV : 3
	e_FitR : 4
	e_FitB : 5
	e_FitBH : 6
	e_FitBV : 7
}
</pre>

getPage()

Returns:

A promise that resolves to the Page that this destination refers to.

Type
PDFNet.Page

getSDFObj()

Returns:

A promise that resolves to 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

Type
PDFNet.Obj

isValid()

Returns:

A promise that resolves to true if this is a valid Destination and can be resolved, false otherwise.

Type
boolean

setPage(page)

Modify the destination so that it refers to the new 'page' as the destination page.

Parameters:
Name Type Description
page PDFNet.Page

The new page associated with this Destination.