Table of Contents

Class PdfString

Namespace
iText.Kernel.Pdf
Assembly
itext.kernel.dll

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

public class PdfString : PdfPrimitiveObject
Inheritance
PdfString
Inherited Members

Remarks

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).

Constructors

PdfString(byte[])

public PdfString(byte[] content)

Parameters

content byte[]
See Also

PdfString(byte[], bool)

Only PdfReader can use this method!

protected PdfString(byte[] content, bool hexWriting)

Parameters

content byte[]

byte content the PdfString will be created from

hexWriting bool

boolean indicating if hex writing will be used

See Also

PdfString(string)

public PdfString(string value)

Parameters

value string
See Also

PdfString(string, string)

public PdfString(string value, string encoding)

Parameters

value string
encoding string
See Also

Fields

encoding

protected string encoding

Field Value

string
See Also

hexWriting

protected bool hexWriting

Field Value

bool
See Also

value

protected string value

Field Value

string
See Also

Methods

CopyContent(PdfObject, PdfDocument, ICopyFilter)

protected override void CopyContent(PdfObject from, PdfDocument document, ICopyFilter copyFilter)

Parameters

from PdfObject
document PdfDocument
copyFilter ICopyFilter
See Also

DecodeContent()

protected virtual byte[] DecodeContent()

Returns

byte[]
See Also

EncodeBytes(byte[])

Escape special symbols or convert to hexadecimal string.

protected virtual byte[] EncodeBytes(byte[] bytes)

Parameters

bytes byte[]

byte array to manipulate with.

Returns

byte[]

Hexadecimal string or string with escaped symbols in byte array view.

Remarks

Escape special symbols or convert to hexadecimal string. This method don't change either value or content ot the PdfString.

See Also

Encrypt(PdfEncryption)

Encrypt content of value and set as content.

protected virtual bool Encrypt(PdfEncryption encrypt)

Parameters

encrypt PdfEncryption

PdfEncryption instance

Returns

bool

true if value was encrypted, otherwise false.

Remarks

Encrypt content of value and set as content. generateContent() won't be called.

See Also

Equals(object)

public override bool Equals(object o)

Parameters

o object

Returns

bool
See Also

GenerateContent()

protected override void GenerateContent()
See Also

GenerateValue()

protected virtual void GenerateValue()
See Also

GetEncoding()

Gets the encoding of this string.

public virtual string GetEncoding()

Returns

string

the name of the encoding specifying the byte representation of current PdfString value

See Also

GetHashCode()

public override int GetHashCode()

Returns

int
See Also

GetObjectType()

public override byte GetObjectType()

Returns

byte
See Also

GetValue()

public virtual string GetValue()

Returns

string
See Also

GetValueBytes()

Gets bytes of String-value considering encoding.

public virtual byte[] GetValueBytes()

Returns

byte[]

byte array

See Also

IsHexWriting()

public virtual bool IsHexWriting()

Returns

bool
See Also

MarkAsUnencryptedObject()

Marks this string object as not encrypted in the encrypted document.

public virtual void MarkAsUnencryptedObject()

Remarks

Marks this string object as not encrypted in the encrypted document.

If it's marked so, it will be considered as already in plaintext and decryption will not be performed for it. In order to have effect, this method shall be called before GetValue() and GetValueBytes() methods.

NOTE: this method is only needed in a very specific cases of encrypted documents. E.g. digital signature dictionary /Contents entry shall not be encrypted. Also this method isn't meaningful in non-encrypted documents.
See Also

NewInstance()

protected override PdfObject NewInstance()

Returns

PdfObject
See Also

SetHexWriting(bool)

public virtual PdfString SetHexWriting(bool hexWriting)

Parameters

hexWriting bool

Returns

PdfString
See Also

ToString()

public override string ToString()

Returns

string
See Also

ToUnicodeString()

Returns the Unicode String value of this PdfString -object.

public virtual string ToUnicodeString()

Returns

string

Unicode string value created by current PdfString object

See Also

See Also