com.lowagie.text.pdf
Class PdfString

java.lang.Object
  extended bycom.lowagie.text.pdf.PdfObject
      extended bycom.lowagie.text.pdf.PdfString
Direct Known Subclasses:
PdfDate

public class PdfString
extends PdfObject

A PdfString-class is the PDF-equivalent of a JAVA-String-object.

A string is a sequence of characters delimited by parenthesis. If a string is too long to be conveniently placed on a single line, it may be split across multiple lines by using the backslash character (\) at the end of a line to indicate that the string continues on the following line. Within a string, the backslash character is used as an escape to specify unbalanced parenthesis, non-printing ASCII characters, and the backslash character itself. Use of the \ddd escape sequence is the preferred way to represent characters outside the printable ASCII character set.
This object is described in the 'Portable Document Format Reference Manual version 1.7' section 3.2.3 (page 53-56).

See Also:
PdfObject, BadPdfFormatException

Field Summary
 
Fields inherited from class com.lowagie.text.pdf.PdfObject
ARRAY, BOOLEAN, DICTIONARY, INDIRECT, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE
 
Constructor Summary
PdfString()
          Constructs an empty PdfString-object.
PdfString(byte[] bytes)
          Constructs a PdfString-object.
PdfString(String value)
          Constructs a PdfString-object.
PdfString(String value, String encoding)
          Constructs a PdfString-object.
 
Method Summary
 byte[] getBytes()
          Gets the presentation of this object in a byte array
 String getEncoding()
          Gets the encoding of this string.
 byte[] getOriginalBytes()
           
 boolean isHexWriting()
           
 PdfString setHexWriting(boolean hexWriting)
           
 void toPdf(PdfWriter writer, OutputStream os)
          Returns the PDF representation of this PdfString.
 String toString()
          Returns the String value of the PdfString-object.
 String toUnicodeString()
           
 
Methods inherited from class com.lowagie.text.pdf.PdfObject
canBeInObjStm, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setIndRef, type
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PdfString

public PdfString()
Constructs an empty PdfString-object.


PdfString

public PdfString(String value)
Constructs a PdfString-object.

Parameters:
value - the content of the string

PdfString

public PdfString(String value,
                 String encoding)
Constructs a PdfString-object.

Parameters:
value - the content of the string
encoding - an encoding

PdfString

public PdfString(byte[] bytes)
Constructs a PdfString-object.

Parameters:
bytes - an array of byte
Method Detail

toPdf

public void toPdf(PdfWriter writer,
                  OutputStream os)
           throws IOException
Returns the PDF representation of this PdfString.

Overrides:
toPdf in class PdfObject
Parameters:
writer - for backwards compatibility
os - the outputstream to write the bytes to.
Throws:
IOException

toString

public String toString()
Returns the String value of the PdfString-object.

Overrides:
toString in class PdfObject
Returns:
a String

getEncoding

public String getEncoding()
Gets the encoding of this string.

Returns:
a String

toUnicodeString

public String toUnicodeString()

getBytes

public byte[] getBytes()
Description copied from class: PdfObject
Gets the presentation of this object in a byte array

Overrides:
getBytes in class PdfObject
Returns:
a byte array

getOriginalBytes

public byte[] getOriginalBytes()

setHexWriting

public PdfString setHexWriting(boolean hexWriting)

isHexWriting

public boolean isHexWriting()


Copyright © 2011 EGIZ - E-Government Innovation Center. All Rights Reserved.