com.lowagie.text.pdf

Class PdfString

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.3' section 4.4 (page 37-39).

See Also: PdfObject BadPdfFormatException

Field Summary
protected Stringencoding
The encoding.
protected booleanhexWriting
protected intobjGen
protected intobjNum
protected StringoriginalValue
protected Stringvalue
The value of this object.
Constructor Summary
PdfString()
Constructs an empty PdfString-object.
PdfString(String value)
Constructs a PdfString-object.
PdfString(String value, String encoding)
Constructs a PdfString-object.
PdfString(byte[] bytes)
Constructs a PdfString-object.
Method Summary
voiddecrypt(PdfReader reader)
byte[]getBytes()
StringgetEncoding()
Gets the encoding of this string.
byte[]getOriginalBytes()
booleanisHexWriting()
PdfStringsetHexWriting(boolean hexWriting)
voidsetObjNum(int objNum, int objGen)
voidtoPdf(PdfWriter writer, OutputStream os)
Returns the PDF representation of this PdfString.
StringtoString()
Returns the String value of the PdfString-object.
StringtoUnicodeString()

Field Detail

encoding

protected String encoding
The encoding.

hexWriting

protected boolean hexWriting

objGen

protected int objGen

objNum

protected int objNum

originalValue

protected String originalValue

value

protected String value
The value of this object.

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

decrypt

void decrypt(PdfReader reader)

getBytes

public byte[] getBytes()

getEncoding

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

Returns: a String

getOriginalBytes

public byte[] getOriginalBytes()

isHexWriting

public boolean isHexWriting()

setHexWriting

public PdfString setHexWriting(boolean hexWriting)

setObjNum

void setObjNum(int objNum, int objGen)

toPdf

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

Returns: an array of bytes

toString

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

Returns: a String

toUnicodeString

public String toUnicodeString()