org.apache.fop.pdf

## Class PDFReference

- java.lang.Object
- - org.apache.fop.pdf.PDFReference

- All Implemented Interfaces:
    PDFWritable

      public class PDFReference
      extends Object
      implements PDFWritable

  Class representing a PDF object reference. The object holds a soft reference to the actual PDF object so the garbage collector can free the object if it's not referenced elsewhere. The important thing about the class is the reference information to the actual PDF object in the PDF file.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFReference(PDFObject obj)` Creates a new PDF reference.
    `PDFReference(String ref)` Creates a new PDF reference, but without a reference to the original object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getGeneration()` Returns the generation.
    `PDFObject` | `getObject()` Returns the PDF object
    `PDFObjectNumber` | `getObjectNumber()` Returns the object number.
    `void` | `outputInline(OutputStream out, StringBuilder textBuffer)` Writes a "direct object" (inline object) representation to the stream.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### PDFReference

          public PDFReference(PDFObject obj)

      Creates a new PDF reference.
      Parameters:
        `obj` - the object to be referenced

    - #### PDFReference

          public PDFReference(String ref)

      Creates a new PDF reference, but without a reference to the original object.
      Parameters:
        `ref` - an object reference

  - ### Method Detail

    - #### getObject

          public PDFObject getObject()

      Returns the PDF object
      Returns:
        the PDF object, or null if it has been released

    - #### getObjectNumber

          public PDFObjectNumber getObjectNumber()

      Returns the object number.
      Returns:
        the object number

    - #### getGeneration

          public int getGeneration()

      Returns the generation.
      Returns:
        the generation

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### outputInline

          public void outputInline(OutputStream out,
                                   StringBuilder textBuffer)

      Writes a "direct object" (inline object) representation to the stream. A text buffer is given for optimized encoding of text content.

      IMPORTANT: If you need to write out binary output, call `PDFDocument.flushTextBuffer(StringBuilder, OutputStream)` before writing any content to the `OutputStream`!

      Specified by:
        `outputInline` in interface `PDFWritable`
      Parameters:
        `out` - the OutputStream (for binary content)
        `textBuffer` - the text buffer for text content

Copyright © 2023 Apache Software Foundation. All rights reserved.