Table of Contents

Class PdfObject

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

PdfObject is the abstract baseclass of all PDF objects. PDF supports seven basic types of objects: bools, numbers, strings, names, arrays, dictionaries and streams. In addition, PDF provides a null object. Objects may be labeled so that they can be referred to by other objects. All these basic PDF objects are described in the 'Portable Document Format Reference Manual version 1.3' Chapter 4 (pages 37-54). @see PdfNull @see Pdfbool @see PdfNumber @see PdfString @see PdfName @see PdfArray @see PdfDictionary @see PdfStream @see PdfIndirectReference

public abstract class PdfObject
Inheritance
PdfObject
Derived
Inherited Members

Constructors

PdfObject(int)

constructors

protected PdfObject(int type)

Parameters

type int

type of the new PdfObject

PdfObject(int, byte[])

Constructs a PdfObject of a certain type with a certain content.

protected PdfObject(int type, byte[] bytes)

Parameters

type int

type of the new PdfObject

bytes byte[]

content of the new PdfObject as an array of byte .

PdfObject(int, string)

Constructs a PdfObject of a certain type with a certain content.

protected PdfObject(int type, string content)

Parameters

type int

type of the new PdfObject

content string

content of the new PdfObject as a String .

Fields

ARRAY

static membervariables (all the possible types of a PdfObject)

public const int ARRAY = 5

Field Value

int

BOOLEAN

a possible type of PdfObject

public const int BOOLEAN = 1

Field Value

int

Bytes

membervariables

protected byte[] Bytes

Field Value

byte[]

DICTIONARY

a possible type of PdfObject

public const int DICTIONARY = 6

Field Value

int

INDIRECT

a possible type of PdfObject

public const int INDIRECT = 10

Field Value

int

NAME

a possible type of PdfObject

public const int NAME = 4

Field Value

int

NOTHING

This is an empty string used for the PdfNull -object and for an empty PdfString -object.

public const string NOTHING = ""

Field Value

string

NULL

a possible type of PdfObject

public const int NULL = 8

Field Value

int

NUMBER

a possible type of PdfObject

public const int NUMBER = 2

Field Value

int

STREAM

a possible type of PdfObject

public const int STREAM = 7

Field Value

int

STRING

a possible type of PdfObject

public const int STRING = 3

Field Value

int

TEXT_PDFDOCENCODING

This is the default encoding to be used for converting strings into bytes and vice versa. The default encoding is PdfDocEcoding.

public const string TEXT_PDFDOCENCODING = "PDF"

Field Value

string

TEXT_UNICODE

This is the encoding to be used to output text in Unicode.

public const string TEXT_UNICODE = "UnicodeBig"

Field Value

string

indRef

Holds value of property indRef.

protected PrIndirectReference indRef

Field Value

PrIndirectReference

type

the type of this PdfObject

protected int type

Field Value

int

Properties

Content

protected string Content { set; }

Property Value

string

IndRef

public PrIndirectReference IndRef { get; set; }

Property Value

PrIndirectReference

Length

public int Length { get; }

Property Value

int

Type

public int Type { get; }

Property Value

int

Methods

CanBeInObjStm()

Can this object be in an object stream?

public bool CanBeInObjStm()

Returns

bool

true if this object can be in an object stream.

GetBytes()

Gets the presentation of this object in a byte array

public virtual byte[] GetBytes()

Returns

byte[]

a byte array

IsArray()

public bool IsArray()

Returns

bool

IsBoolean()

public bool IsBoolean()

Returns

bool

IsDictionary()

public bool IsDictionary()

Returns

bool

IsIndirect()

Checks if this is an indirect object.

public bool IsIndirect()

Returns

bool

true if this is an indirect object

IsName()

public bool IsName()

Returns

bool

IsNull()

public bool IsNull()

Returns

bool

IsNumber()

public bool IsNumber()

Returns

bool

IsStream()

public bool IsStream()

Returns

bool

IsString()

public bool IsString()

Returns

bool

ToPdf(PdfWriter, Stream)

public virtual void ToPdf(PdfWriter writer, Stream os)

Parameters

writer PdfWriter
os Stream

ToString()

Returns the length of the PDF representation of the PdfObject . In some cases, namely for PdfString and PdfStream , this method differs from the method length because length returns the length of the actual content of the PdfObject . Remark: the actual content of an object is in most cases identical to its representation. The following statement is always true: Length() >= PdfLength().

public override string ToString()

Returns

string

a length