org.apache.fop.pdf

## Class PDFGoTo

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFAction
    - - org.apache.fop.pdf.PDFGoTo

- All Implemented Interfaces:
    PDFWritable

      public class PDFGoTo
      extends PDFAction

  class representing a /GoTo object. This can either have a Goto to a page reference and location or to a specified PDF reference string.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.pdf.PDFObject

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFGoTo(String pageReference)` create a /GoTo object.
    `PDFGoTo(String destination, boolean isNamedDestination)` create a /GoTo object.
    `PDFGoTo(String pageReference, Point2D position)` create a /GoTo object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `contentEquals(PDFObject obj)` Check if the other PDFObject has the same content as the current object.
    `String` | `getAction()` Get the PDF reference for the GoTo action.
    `void` | `setDestination(String dest)` Set the destination string for this Goto.
    `void` | `setPageReference(PDFReference pageReference)` Sets page reference after object has been created
    `void` | `setPosition(Point2D position)` Sets the target (X,Y) position
    `void` | `setXPosition(float xPosition)` Sets the x Position to jump to
    `void` | `setYPosition(float yPosition)` Sets the Y position to jump to
    `String` | `toPDFString()` This method returns a String representation of the PDF object.

    - ### Methods inherited from class org.apache.fop.pdf.PDFAction

      `encodeScript`

    - ### Methods inherited from class org.apache.fop.pdf.PDFObject

      `encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getChildren, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PDFGoTo

          public PDFGoTo(String destination,
                         boolean isNamedDestination)

      create a /GoTo object.
      Parameters:
        `destination` - name of the destination
        `isNamedDestination` - set to true if the destination is a named destination

    - #### PDFGoTo

          public PDFGoTo(String pageReference)

      create a /GoTo object.
      Parameters:
        `pageReference` - the pageReference represented by this object

    - #### PDFGoTo

          public PDFGoTo(String pageReference,
                         Point2D position)

      create a /GoTo object.
      Parameters:
        `pageReference` - the PDF reference to the target page
        `position` - the target area's on-page coordinates in points

  - ### Method Detail

    - #### setPageReference

          public void setPageReference(PDFReference pageReference)

      Sets page reference after object has been created
      Parameters:
        `pageReference` - the new page reference to use

    - #### setPosition

          public void setPosition(Point2D position)

      Sets the target (X,Y) position
      Parameters:
        `position` - the target's on-page coordinates in points

    - #### setXPosition

          public void setXPosition(float xPosition)

      Sets the x Position to jump to
      Parameters:
        `xPosition` - x position

    - #### setYPosition

          public void setYPosition(float yPosition)

      Sets the Y position to jump to
      Parameters:
        `yPosition` - y position

    - #### setDestination

          public void setDestination(String dest)

      Set the destination string for this Goto.
      Parameters:
        `dest` - the PDF destination string

    - #### getAction

          public String getAction()

      Get the PDF reference for the GoTo action.
      Specified by:
        `getAction` in class `PDFAction`
      Returns:
        the PDF reference for the action

    - #### toPDFString

          public String toPDFString()

      This method returns a String representation of the PDF object. The result is normally converted/encoded to a byte array by toPDF(). Only use this method to implement the serialization if the object can be fully represented as text. If the PDF representation of the object contains binary content use toPDF() or output(OutputStream) instead. This applies to any object potentially containing a string object because string object are encrypted and therefore need to be binary.
      Overrides:
        `toPDFString` in class `PDFObject`
      Returns:
        String the String representation

    - #### contentEquals

          protected boolean contentEquals(PDFObject obj)

      Check if the other PDFObject has the same content as the current object.

      Note: This function has a contract which is less binding than `Object.equals(Object)`. Whereas equals would require all values to be identical, this method is not required to check everything. In the case of PDFObjects, this means that the overriding function does not have to check for `PDFObject.getObjectID()`.

      Overrides:
        `contentEquals` in class `PDFObject`
      Parameters:
        `obj` - object to compare to.
      Returns:
        true if the other object has the same content.

Copyright © 2023 Apache Software Foundation. All rights reserved.