org.apache.fop.pdf

## Class PDFLink

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFLink

- All Implemented Interfaces:
    PDFWritable

      public class PDFLink
      extends PDFObject

  class representing an /Annot object of /Subtype /Link

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `EXTERNAL` Used to represent an external link.
    `static int` | `INTERNAL` Used to represent an internal link.

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

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFLink(Rectangle2D r)` create objects associated with a link annotation (GoToR)

  - ### 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.
    `void` | `getChildren(Set<PDFObject> children)`
    `void` | `setAction(PDFAction action)` Set the pdf action for this link.
    `void` | `setStructParent(int structParent)` Sets the value of the StructParent entry for this link.
    `String` | `toPDFString()` This method returns a String representation of the PDF object.

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

      `encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, 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`

- - ### Field Detail

    - #### EXTERNAL

          public static final int EXTERNAL

      Used to represent an external link.
      See Also:
        Constant Field Values

    - #### INTERNAL

          public static final int INTERNAL

      Used to represent an internal link.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PDFLink

          public PDFLink(Rectangle2D r)

      create objects associated with a link annotation (GoToR)
      Parameters:
        `r` - the rectangle of the link hotspot in absolute coordinates

  - ### Method Detail

    - #### setAction

          public void setAction(PDFAction action)

      Set the pdf action for this link.
      Parameters:
        `action` - the pdf action that is activated for this link

    - #### setStructParent

          public void setStructParent(int structParent)

      Sets the value of the StructParent entry for this link.
      Parameters:
        `structParent` - key in the structure parent tree

    - #### 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.

    - #### getChildren

          public void getChildren(Set<PDFObject> children)

      Overrides:
        `getChildren` in class `PDFObject`

Copyright © 2023 Apache Software Foundation. All rights reserved.