Skip to main content

GoToAction Class

Defines an action that navigates to a page in the current PDF document.

Declaration

public class GoToAction extends InteractiveAction

Remarks

  1. Create a GoToAction object.
  2. Create a FitDestination and pass it to the setDestination(Destination value) method.
  3. Call the setPage(Page value) method to specify the destination page.
  4. Assign the GoToAction object to the annotation.

The following code snippet creates a link annotation that opens the specified page in the current document:

void createGoToActionLinkAnnotation(Page page, Page destinationPage) {
    // Add link text.
    float textX = 50;
    float textY = 700;
    TextFragment textFragment = new TextFragment() {{
        setText("Learn More");
        setLocation(new PointF(textX, textY));
    }};
    page.getFragments().add(textFragment);

    // Create a link annotation.
    float textWidth = textFragment.measure().getSize().getWidth();
    float textHeight = textFragment.measure().getSize().getHeight();
    float offset = 10;

    LinkAnnotation link = new LinkAnnotation(new RectangleF(
            textX - offset,
            textY - offset,
            textWidth + offset * 2,
            textHeight + offset * 2));

    GoToAction action = new GoToAction();
    action.setDestination(new FitDestination());
    action.setPage(destinationPage);

    link.setAction(action);
    link.setHighlightingMode(AnnotationHighlightingMode.PUSH);

    page.getAnnotations().add(link);
}

Refer to the following help topic for additional information: Document Navigation Annotations.

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
JavaObject

GoToAction()

Initializes a new instance of the GoToAction class.

Declaration

public GoToAction()

Methods

getDestination() Method

Returns the destination view for the go-to action.

Declaration

public Destination getDestination()

Returns

Type Description
Destination

The destination view for the go-to action.

getPage() Method

Returns the target page for the go-to action.

Declaration

public Page getPage()

Returns

Type Description
Page

The target page for the go-to action.

setDestination(Destination value) Method

Sets the destination view for the go-to action.

Declaration

public void setDestination(Destination value)

Parameters

Name Type Description
value Destination

The destination view for the go-to action.

setPage(Page value) Method

Sets the target page for the go-to action.

Declaration

public void setPage(Page value)

Parameters

Name Type Description
value Page

The target page for the go-to action.