Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.pdf
Class PDFText

    java.lang.Object
      org.apache.fop.pdf.PDFObject
          org.apache.fop.pdf.PDFText

All Implemented Interfaces:
  PDFWritable

public class PDFText
extends PDFObject

This class represents a simple number object. It also contains contains some utility methods for outputting numbers to PDF.

Field Summary

Fields inherited from class org.apache.fop.pdf.PDFObject
`DATE_FORMAT, log`

Constructor Summary
`PDFText()`

Method Summary
`static byte[]` | `escapeByteArray(byte[] data)` Escape a byte array for output to PDF (Used for encrypted strings)
`static java.lang.String` | `escapeString(java.lang.String s)` Escaped a String as described in section 4.4 in the PDF 1.3 specs.
`static void` | `escapeStringChar(char c, java.lang.StringBuffer target)` Escapes a character conforming to the rules established in the PostScript Language Reference (Search for "Literal Text Strings").
`static java.lang.String` | `escapeText(java.lang.String text)` Escape text (see 4.4.1 in PDF 1.3 specs)
`static java.lang.String` | `escapeText(java.lang.String text, boolean forceHexMode)` Escape text (see 4.4.1 in PDF 1.3 specs)
`java.lang.String` | `getText()` Returns the text.
`void` | `setText(java.lang.String text)` Sets the text.
`static java.lang.String` | `toHex(byte[] data)` Converts a byte array to a Hexadecimal String (3.2.3 in PDF 1.4 specs)
`static java.lang.String` | `toHex(byte[] data, boolean brackets)` Converts a byte array to a Hexadecimal String (3.2.3 in PDF 1.4 specs)
`protected java.lang.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.
`static java.lang.String` | `toUnicodeHex(char c)` Convert a char to a multibyte hex representation
`static byte[]` | `toUTF16(java.lang.String text)` Converts a String to UTF-16 (big endian).

Methods inherited from class org.apache.fop.pdf.PDFObject
`contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatDateTime, formatDateTime, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setParent, toPDF`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PDFText

    public PDFText()

Method Detail

### getText

    public java.lang.String getText()

  Returns the text.

  Returns:
    the text

### setText

    public void setText(java.lang.String text)

  Sets the text.

  Parameters:
    `text` - the text

### toPDFString

    protected java.lang.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

### escapeText

    public static final java.lang.String escapeText(java.lang.String text)

  Escape text (see 4.4.1 in PDF 1.3 specs)

  Parameters:
    `text` - the text to encode
  Returns:
    encoded text

### escapeText

    public static final java.lang.String escapeText(java.lang.String text,
                                                    boolean forceHexMode)

  Escape text (see 4.4.1 in PDF 1.3 specs)

  Parameters:
    `text` - the text to encode
    `forceHexMode` - true if the output should follow the hex encoding rules
  Returns:
    encoded text

### toHex

    public static final java.lang.String toHex(byte[] data,
                                               boolean brackets)

  Converts a byte array to a Hexadecimal String (3.2.3 in PDF 1.4 specs)

  Parameters:
    `data` - the data to encode
    `brackets` - true if enclosing brackets should be included
  Returns:
    String the resulting string

### toHex

    public static final java.lang.String toHex(byte[] data)

  Converts a byte array to a Hexadecimal String (3.2.3 in PDF 1.4 specs)

  Parameters:
    `data` - the data to encode
  Returns:
    String the resulting string

### toUTF16

    public static final byte[] toUTF16(java.lang.String text)

  Converts a String to UTF-16 (big endian).

  Parameters:
    `text` - text to convert
  Returns:
    byte[] UTF-16 stream

### toUnicodeHex

    public static final java.lang.String toUnicodeHex(char c)

  Convert a char to a multibyte hex representation

  Parameters:
    `c` - character to encode
  Returns:
    the encoded character

### escapeString

    public static final java.lang.String escapeString(java.lang.String s)

  Escaped a String as described in section 4.4 in the PDF 1.3 specs.

  Parameters:
    `s` - String to escape
  Returns:
    String the escaped String

### escapeStringChar

    public static final void escapeStringChar(char c,
                                              java.lang.StringBuffer target)

  Escapes a character conforming to the rules established in the PostScript Language Reference (Search for "Literal Text Strings").

  Parameters:
    `c` - character to escape
    `target` - target StringBuffer to write the escaped character to

### escapeByteArray

    public static final byte[] escapeByteArray(byte[] data)

  Escape a byte array for output to PDF (Used for encrypted strings)

  Parameters:
    `data` - data to encode
  Returns:
    byte[] encoded data

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.