Table of Contents

Class PdfIndirectReference

Namespace
iText.Kernel.Pdf
Assembly
itext.kernel.dll
public class PdfIndirectReference : PdfObject, IComparable<PdfIndirectReference>
Inheritance
PdfIndirectReference
Implements
Inherited Members

Constructors

PdfIndirectReference(PdfDocument, int)

protected PdfIndirectReference(PdfDocument doc, int objNr)

Parameters

doc PdfDocument
objNr int

PdfIndirectReference(PdfDocument, int, int)

protected PdfIndirectReference(PdfDocument doc, int objNr, int genNr)

Parameters

doc PdfDocument
objNr int
genNr int

PdfIndirectReference(PdfDocument, int, int, long)

protected PdfIndirectReference(PdfDocument doc, int objNr, int genNr, long offset)

Parameters

doc PdfDocument
objNr int
genNr int
offset long

Fields

genNr

Object generation.

protected int genNr

Field Value

int

objNr

Object number.

protected readonly int objNr

Field Value

int

objectStreamNumber

Indirect reference number of object stream containing refersTo object.

protected int objectStreamNumber

Field Value

int

Remarks

Indirect reference number of object stream containing refersTo object. If refersTo is not placed into object stream - objectStreamNumber = 0.

offsetOrIndex

Offset in a document of the refersTo object.

protected long offsetOrIndex

Field Value

long

Remarks

Offset in a document of the refersTo object. If the object placed into object stream then it is an object index inside object stream.

pdfDocument

PdfDocument object belongs to.

protected PdfDocument pdfDocument

Field Value

PdfDocument

Remarks

PdfDocument object belongs to. For direct objects it is null.

refersTo

PdfObject that current PdfIndirectReference instance refers to.

protected PdfObject refersTo

Field Value

PdfObject

Methods

CompareTo(PdfIndirectReference)

public virtual int CompareTo(PdfIndirectReference o)

Parameters

o PdfIndirectReference

Returns

int

CopyContent(PdfObject, PdfDocument)

protected override void CopyContent(PdfObject from, PdfDocument document)

Parameters

from PdfObject
document PdfDocument

CopyContent(PdfObject, PdfDocument, ICopyFilter)

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

Parameters

from PdfObject
document PdfDocument
copyFilter ICopyFilter

Equals(object)

public override bool Equals(object o)

Parameters

o object

Returns

bool

GetDocument()

public virtual PdfDocument GetDocument()

Returns

PdfDocument

GetGenNumber()

public virtual int GetGenNumber()

Returns

int

GetHashCode()

public override int GetHashCode()

Returns

int

GetIndex()

Gets refersTo object index in the object stream.

public virtual int GetIndex()

Returns

int

object index in a document. If refersTo object is not in object stream then -1.

GetObjNumber()

public virtual int GetObjNumber()

Returns

int

GetObjStreamNumber()

public virtual int GetObjStreamNumber()

Returns

int

GetObjectType()

public override byte GetObjectType()

Returns

byte

GetOffset()

Gets refersTo object offset in a document.

public virtual long GetOffset()

Returns

long

object offset in a document. If refersTo object is in object stream then -1.

GetReader()

Gets a PdfReader associated with the document object belongs to.

protected virtual PdfReader GetReader()

Returns

PdfReader

PdfReader.

GetRefersTo()

public virtual PdfObject GetRefersTo()

Returns

PdfObject

GetRefersTo(bool)

Gets direct object and try to resolve indirects chain.

public virtual PdfObject GetRefersTo(bool recursively)

Parameters

recursively bool

true to resolve indirects chain

Returns

PdfObject

the PdfObject result of indirect reference resolving

Remarks

Gets direct object and try to resolve indirects chain.

Note: If chain of references has length of more than 32, this method return 31st reference in chain.

GetWriter()

Gets a PdfWriter associated with the document object belongs to.

protected virtual PdfWriter GetWriter()

Returns

PdfWriter

PdfWriter.

IsFree()

Checks if this PdfIndirectReference instance corresponds to free indirect reference.

public virtual bool IsFree()

Returns

bool

true if this PdfIndirectReference is free, false otherwise.

Remarks

Checks if this PdfIndirectReference instance corresponds to free indirect reference. Indirect reference might be in a free state either because it was read as such from the opened existing PDF document or because it was set free via SetFree() method.

NewInstance()

protected override PdfObject NewInstance()

Returns

PdfObject

SetFree()

Marks indirect reference as free in the document.

public virtual void SetFree()

Remarks

Marks indirect reference as free in the document. This doesn't "remove" indirect objects from the document, it only ensures that corresponding xref entry is free and indirect object referred by this reference is no longer linked to it. Actual object still might be written to the resultant document (and would get a new corresponding indirect reference in this case) if it is still contained in some other object.

This method will not give any result if the corresponding indirect object or another object that contains a reference to this object is already flushed.

Note: in some cases, removing a link of indirect object to it's indirect reference while leaving the actual object in the document structure might lead to errors, because some objects are expected to always have such explicit link (e.g. Catalog object, page objects, etc).

SetRefersTo(PdfObject)

protected virtual void SetRefersTo(PdfObject refersTo)

Parameters

refersTo PdfObject

SetState(short)

Sets special states of current object.

protected override PdfObject SetState(short state)

Parameters

state short

special flag of current object

Returns

PdfObject

ToString()

public override string ToString()

Returns

string