Class PDFName

All Implemented Interfaces:
Serializable, PDFWritable

public class PDFName extends PDFObject implements Serializable
Class representing a PDF name object.
See Also:
  • Field Details

  • Constructor Details

    • PDFName

      public PDFName(String name)
      Creates a new PDF name object.
      Parameters:
      name - the name value
  • Method Details

    • escapeName

      static String escapeName(String name)
      Escapes a PDF name. It adds the leading slash and escapes characters as necessary.
      Parameters:
      name - the name
      Returns:
      the escaped name
    • toHex

      private static void toHex(char ch, StringBuilder sb)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
      Returns the name without the leading slash.
      Returns:
      the name without the leading slash
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • output

      public int output(OutputStream stream) throws IOException
      Description copied from class: PDFObject
      Write the PDF represention of this object
      Overrides:
      output in class PDFObject
      Parameters:
      stream - the stream to write the PDF to
      Returns:
      the number of bytes written
      Throws:
      IOException - if there is an error writing to the stream
    • outputInline

      public void outputInline(OutputStream out, StringBuilder textBuffer) throws IOException
      Description copied from class: PDFObject
      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
      Overrides:
      outputInline in class PDFObject
      Parameters:
      out - the OutputStream (for binary content)
      textBuffer - the text buffer for text content
      Throws:
      IOException - if an I/O error occurs