org.icepdf.core.pobjects
Class Destination

java.lang.Object
  extended by org.icepdf.core.pobjects.Destination

public class Destination
extends java.lang.Object

The Destination class defines a particular view of a PDF document consisting of the following items:

Destination can be associated with outline items, annotations, or actions. In each case the destination specifies the view of the document to be presented when one of the respective objects is activated.

The Destination class currently only supports the Destination syntaxes, [page /XYZ left top zoom], other syntax will be added in future releases. The syntax [page /XYZ left top zoom] is defined as follows:

A null value for left, top or zoom specifies that the current view values will be unchanged when navigating to the specified page.

Since:
1.0
See Also:
Annotation, OutlineItem, Action

Field Summary
static Name TYPE_FIT
           
static Name TYPE_FITB
           
static Name TYPE_FITBH
           
static Name TYPE_FITBV
           
static Name TYPE_FITH
           
static Name TYPE_FITR
           
static Name TYPE_FITV
           
static Name TYPE_XYZ
           
 
Constructor Summary
Destination(Library l, java.lang.Object h)
          Creates a new instance of a Destination.
 
Method Summary
static java.util.Vector<java.lang.Object> destinationSyntax(Reference page, Name type)
          Utility for creating a /Fit or FitB syntax vector.
static java.util.Vector<java.lang.Object> destinationSyntax(Reference page, Name type, java.lang.Object offset)
          Utility for creating a /FitH, /FitV, /FitBH or /FitBV syntax vector.
static java.util.Vector<java.lang.Object> destinationSyntax(Reference page, java.lang.Object type, java.lang.Object left, java.lang.Object top, java.lang.Object zoom)
          Utility for creating a /XYZ syntax vector.
static java.util.Vector<java.lang.Object> destinationSyntax(Reference page, java.lang.Object type, java.lang.Object left, java.lang.Object bottom, java.lang.Object right, java.lang.Object top)
          Utility for creating a /FitR syntax vector.
 java.lang.Float getBottom()
          Bottom coordinate of a zoom box, if present left, right and top should also be available.
 java.lang.Object getEncodedDestination()
          Get the destination properties encoded in post script form.
 java.lang.Float getLeft()
          Gets the left offset from the top, left position of the page specified by this destination.
 Name getNamedDestination()
          Gets the name of the named destination.
 java.lang.Object getObject()
          Get the dictionary object, name, string or array.
 Reference getPageReference()
          Gets the Page Reference specified by the destination.
 Reference getRef()
          Gets the page reference represented by this destination
 java.lang.Float getRight()
          Right coordinate of a zoom box, if present bottom, left and top should also be available.
 java.lang.Float getTop()
          Gets the top offset from the top, left position of the page specified by this destination.
 Name getType()
          Gets the type used in a vector of destination syntax.
 java.lang.Float getZoom()
          Gets the zoom level specifed by the destination.
 void setDestinationSyntax(java.util.Vector destinationSyntax)
          Sets the destination syntax to the specified value.
 void setNamedDestination(Name dest)
          Sets the named destination as a Named destination.
 java.lang.String toString()
          Returns a summary of the annotation dictionary values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_XYZ

public static final Name TYPE_XYZ

TYPE_FIT

public static final Name TYPE_FIT

TYPE_FITH

public static final Name TYPE_FITH

TYPE_FITV

public static final Name TYPE_FITV

TYPE_FITR

public static final Name TYPE_FITR

TYPE_FITB

public static final Name TYPE_FITB

TYPE_FITBH

public static final Name TYPE_FITBH

TYPE_FITBV

public static final Name TYPE_FITBV
Constructor Detail

Destination

public Destination(Library l,
                   java.lang.Object h)
Creates a new instance of a Destination.

Parameters:
l - document library.
h - Destination dictionary entries.
Method Detail

getObject

public java.lang.Object getObject()
Get the dictionary object, name, string or array.

Returns:

getNamedDestination

public Name getNamedDestination()
Gets the name of the named destination.

Returns:
name of destination if present, null otherwise.

setNamedDestination

public void setNamedDestination(Name dest)
Sets the named destination as a Named destination. It is assumed the named destination already exists in the document.

Parameters:
dest - destination to associate with.

setDestinationSyntax

public void setDestinationSyntax(java.util.Vector destinationSyntax)
Sets the destination syntax to the specified value. The Destinatoin object clears the named destination and re initializes itself after the assignment has been made.

Parameters:
destinationSyntax - new vector of destination syntax.

destinationSyntax

public static java.util.Vector<java.lang.Object> destinationSyntax(Reference page,
                                                                   Name type)
Utility for creating a /Fit or FitB syntax vector.

Parameters:
page - destination page pointer.
type - type of destionation
Returns:
new instance of vector containing well formed destination syntax.

destinationSyntax

public static java.util.Vector<java.lang.Object> destinationSyntax(Reference page,
                                                                   Name type,
                                                                   java.lang.Object offset)
Utility for creating a /FitH, /FitV, /FitBH or /FitBV syntax vector.

Parameters:
page - destination page pointer.
type - type of destionation
offset - offset coordinate value in page space for specified dest type.
Returns:
new instance of vector containing well formed destination syntax.

destinationSyntax

public static java.util.Vector<java.lang.Object> destinationSyntax(Reference page,
                                                                   java.lang.Object type,
                                                                   java.lang.Object left,
                                                                   java.lang.Object top,
                                                                   java.lang.Object zoom)
Utility for creating a /XYZ syntax vector.

Parameters:
page - destination page pointer.
type - type of destionation
left - offset coordinate value in page space for specified dest type.
top - offset coordinate value in page space for specified dest type.
zoom - page zoom, 0 or null indicates no zoom.
Returns:
new instance of vector containing well formed destination syntax.

destinationSyntax

public static java.util.Vector<java.lang.Object> destinationSyntax(Reference page,
                                                                   java.lang.Object type,
                                                                   java.lang.Object left,
                                                                   java.lang.Object bottom,
                                                                   java.lang.Object right,
                                                                   java.lang.Object top)
Utility for creating a /FitR syntax vector.

Parameters:
page - destination page pointer.
type - type of destionation
left - offset coordinate value in page space for specified dest type.
top - offset coordinate value in page space for specified dest type.
bottom - offset coordinate value in page space for specified dest type.
right - offset coordinate value in page space for specified dest type.
Returns:
new instance of vector containing well formed destination syntax.

getPageReference

public Reference getPageReference()
Gets the Page Reference specified by the destination.

Returns:
a Reference to the Page Object associated with this destination.

getLeft

public java.lang.Float getLeft()
Gets the left offset from the top, left position of the page specified by this destination.

Returns:
the left offset from the top, left position of the page. If not specified Float.NaN is returned.

getTop

public java.lang.Float getTop()
Gets the top offset from the top, left position of the page specified by this destination.

Returns:
the top offset from the top, left position of the page. If not specified Float.NaN is returned.

getZoom

public java.lang.Float getZoom()
Gets the zoom level specifed by the destination.

Returns:
the specified zoom level, Float.NaN if not specified.

getRef

public Reference getRef()
Gets the page reference represented by this destination

Returns:
reference of page that destination should show when executed.

getType

public Name getType()
Gets the type used in a vector of destination syntax. Will be null if a named destination is used.

Returns:
type of destination syntax as defined by class constants.

getBottom

public java.lang.Float getBottom()
Bottom coordinate of a zoom box, if present left, right and top should also be available.

Returns:
bottom coordinate of magnifcation box.

getRight

public java.lang.Float getRight()
Right coordinate of a zoom box, if present bottom, left and top should also be available.

Returns:
rigth coordinate of zoom box

getEncodedDestination

public java.lang.Object getEncodedDestination()
Get the destination properties encoded in post script form.

Returns:
either a destination Name or a Vector representing the destination

toString

public java.lang.String toString()
Returns a summary of the annotation dictionary values.

Overrides:
toString in class java.lang.Object
Returns:
dictionary values.