iText 8.0.5 API
iText.Kernel.Pdf.PdfObject Class Referenceabstract
Inheritance diagram for iText.Kernel.Pdf.PdfObject:
iText.Kernel.Pdf.PdfArray iText.Kernel.Pdf.PdfDictionary iText.Kernel.Pdf.PdfIndirectReference iText.Kernel.Pdf.PdfPrimitiveObject iText.Kernel.Pdf.PdfTextArray iText.Kernel.Pdf.PdfStream iText.Kernel.Pdf.PdfBoolean iText.Kernel.Pdf.PdfLiteral iText.Kernel.Pdf.PdfName iText.Kernel.Pdf.PdfNull iText.Kernel.Pdf.PdfNumber iText.Kernel.Pdf.PdfString

Public Member Functions

abstract byte  GetObjectType ()
  Gets object type. More...
 
void  Flush ()
  Flushes the object to the document. More...
 
void  Flush (bool canBeInObjStm)
  Flushes the object to the document. More...
 
virtual PdfIndirectReference  GetIndirectReference ()
  Gets the indirect reference associated with the object. More...
 
virtual bool  IsIndirect ()
  Checks if object is indirect. More...
 
virtual PdfObject  MakeIndirect (PdfDocument document, PdfIndirectReference reference)
  Marks object to be saved as indirect. More...
 
virtual PdfObject  MakeIndirect (PdfDocument document)
  Marks object to be saved as indirect. More...
 
virtual bool  IsFlushed ()
  Indicates is the object has been flushed or not. More...
 
virtual bool  IsModified ()
  Indicates is the object has been set as modified or not. More...
 
virtual PdfObject  Clone ()
  Creates clone of the object which belongs to the same document as original object. More...
 
virtual PdfObject  Clone (ICopyFilter filter)
  Creates clone of the object which belongs to the same document as original object. More...
 
virtual PdfObject  CopyTo (PdfDocument document)
  Copies object to a specified document. More...
 
virtual PdfObject  CopyTo (PdfDocument document, bool allowDuplicating)
  Copies object to a specified document. More...
 
virtual PdfObject  CopyTo (PdfDocument document, ICopyFilter copyFilter)
  Copies object to a specified document. More...
 
virtual PdfObject  CopyTo (PdfDocument document, bool allowDuplicating, ICopyFilter copyFilter)
  Copies object to a specified document. More...
 
virtual PdfObject  SetModified ()
  Sets the 'modified' flag to the indirect object, the flag denotes that the object was modified since the document opening. More...
 
virtual bool  IsReleaseForbidden ()
  Checks if it's forbidden to release this PdfObject instance. More...
 
virtual void  Release ()
 
virtual bool  IsNull ()
  Checks if this PdfObject is of the type PdfNull. More...
 
virtual bool  IsBoolean ()
  Checks if this PdfObject is of the type PdfBoolean. More...
 
virtual bool  IsNumber ()
  Checks if this PdfObject is of the type PdfNumber. More...
 
virtual bool  IsString ()
  Checks if this PdfObject is of the type PdfString. More...
 
virtual bool  IsName ()
  Checks if this PdfObject is of the type PdfName. More...
 
virtual bool  IsArray ()
  Checks if this PdfObject is of the type PdfArray. More...
 
virtual bool  IsDictionary ()
  Checks if this PdfObject is of the type PdfDictionary. More...
 
virtual bool  IsStream ()
  Checks if this PdfObject is of the type PdfStream. More...
 
virtual bool  IsIndirectReference ()
  Checks if this PdfObject is of the type PdfIndirectReference. More...
 
virtual bool  IsLiteral ()
  Checks if this PdfObject is of the type PdfLiteral. More...
 

Static Public Attributes

const byte  ARRAY = 1
 
const byte  BOOLEAN = 2
 
const byte  DICTIONARY = 3
 
const byte  LITERAL = 4
 
const byte  INDIRECT_REFERENCE = 5
 
const byte  NAME = 6
 
const byte  NULL = 7
 
const byte  NUMBER = 8
 
const byte  STREAM = 9
 
const byte  STRING = 10
 

Package Functions

virtual PdfObject  SetIndirectReference (PdfIndirectReference indirectReference)
 
abstract PdfObject  NewInstance ()
  Creates new instance of object. More...
 
virtual bool  CheckState (short state)
  Checks state of the flag of current object. More...
 
virtual PdfObject  SetState (short state)
  Sets special states of current object. More...
 
virtual PdfObject  ClearState (short state)
  Clear state of the flag of current object. More...
 
virtual void  CopyContent (PdfObject from, PdfDocument document)
  Copies object content from object 'from'. More...
 
virtual void  CopyContent (PdfObject from, PdfDocument document, ICopyFilter filter)
  Copies object content from object 'from'. More...
 

Package Attributes

PdfIndirectReference  indirectReference = null
  If object is flushed the indirect reference is kept here. More...
 

Static Package Attributes

const short  FLUSHED = 1
  Indicates if the object has been flushed. More...
 
const short  FREE = 1 << 1
  Indicates that the indirect reference of the object could be reused or have to be marked as free. More...
 
const short  READING = 1 << 2
  Indicates that definition of the indirect reference of the object still not found (e.g. keys in XRefStm). More...
 
const short  MODIFIED = 1 << 3
  Indicates that object changed (is used in append mode). More...
 
const short  ORIGINAL_OBJECT_STREAM = 1 << 4
  Indicates that the indirect reference of the object represents ObjectStream from original document. More...
 
const short  MUST_BE_FLUSHED = 1 << 5
  For internal usage only. More...
 
const short  MUST_BE_INDIRECT = 1 << 6
  Indicates that the object shall be indirect when it is written to the document. More...
 
const short  FORBID_RELEASE = 1 << 7
  Indicates that the object is highly sensitive and we do not want to release it even if release() is called. More...
 
const short  READ_ONLY = 1 << 8
  Indicates that we do not want this object to be ever written into the resultant document (because of multiple objects read from the same reference inconsistency). More...
 
const short  UNENCRYPTED = 1 << 9
  Indicates that this object is not encrypted in the encrypted document. More...
 

Member Function Documentation

◆ CheckState()

virtual bool iText.Kernel.Pdf.PdfObject.CheckState ( short  state )
inlinepackagevirtual

Checks state of the flag of current object.

Parameters
state special flag to check
Returns
true if the state was set.

◆ ClearState()

virtual PdfObject iText.Kernel.Pdf.PdfObject.ClearState ( short  state )
inlinepackagevirtual

Clear state of the flag of current object.

Parameters
state special flag state to clear
Returns
this PdfObject

◆ Clone() [1/2]

virtual PdfObject iText.Kernel.Pdf.PdfObject.Clone ( )
inlinevirtual

Creates clone of the object which belongs to the same document as original object.

Creates clone of the object which belongs to the same document as original object. New object shall not be used in other documents.

Returns
cloned object.

◆ Clone() [2/2]

virtual PdfObject iText.Kernel.Pdf.PdfObject.Clone ( ICopyFilter  filter )
inlinevirtual

Creates clone of the object which belongs to the same document as original object.

Creates clone of the object which belongs to the same document as original object. New object shall not be used in other documents.

Parameters
filter Filter what will be copied or not
Returns
cloned object.

◆ CopyContent() [1/2]

virtual void iText.Kernel.Pdf.PdfObject.CopyContent ( PdfObject  from,
PdfDocument  document 
)
inlinepackagevirtual

Copies object content from object 'from'.

Parameters
from object to copy content from.
document document to copy object to.

Reimplemented in iText.Kernel.Pdf.PdfDictionary, iText.Kernel.Pdf.PdfStream, and iText.Kernel.Pdf.PdfIndirectReference.

◆ CopyContent() [2/2]

virtual void iText.Kernel.Pdf.PdfObject.CopyContent ( PdfObject  from,
PdfDocument  document,
ICopyFilter  filter 
)
inlinepackagevirtual

Copies object content from object 'from'.

Parameters
from object to copy content from.
document document to copy object to.
filter

iText.Kernel.Utils.ICopyFilter a filter that will apply on dictionaries and array Use iText.Kernel.Utils.NullCopyFilter for no filtering

Reimplemented in iText.Kernel.Pdf.PdfName, iText.Kernel.Pdf.PdfArray, iText.Kernel.Pdf.PdfDictionary, iText.Kernel.Pdf.PdfStream, iText.Kernel.Pdf.PdfString, iText.Kernel.Pdf.PdfIndirectReference, iText.Kernel.Pdf.PdfNumber, iText.Kernel.Pdf.PdfLiteral, iText.Kernel.Pdf.PdfPrimitiveObject, iText.Kernel.Pdf.PdfBoolean, and iText.Kernel.Pdf.PdfNull.

◆ CopyTo() [1/4]

virtual PdfObject iText.Kernel.Pdf.PdfObject.CopyTo ( PdfDocument  document )
inlinevirtual

Copies object to a specified document.

Copies object to a specified document.

NOTE: Works only for objects that are read from document opened in reading mode, otherwise an exception is thrown.

Parameters
document document to copy object to.
Returns
copied object.

◆ CopyTo() [2/4]

virtual PdfObject iText.Kernel.Pdf.PdfObject.CopyTo ( PdfDocument  document,
bool  allowDuplicating 
)
inlinevirtual

Copies object to a specified document.

Copies object to a specified document.

NOTE: Works only for objects that are read from document opened in reading mode, otherwise an exception is thrown.

Parameters
document document to copy object to.
allowDuplicating indicates if to allow copy objects which already have been copied. If object is associated with any indirect reference and allowDuplicating is false then already existing reference will be returned instead of copying object. If allowDuplicating is true then object will be copied and new indirect reference will be assigned.
Returns
copied object.

◆ CopyTo() [3/4]

virtual PdfObject iText.Kernel.Pdf.PdfObject.CopyTo ( PdfDocument  document,
bool  allowDuplicating,
ICopyFilter  copyFilter 
)
inlinevirtual

Copies object to a specified document.

Copies object to a specified document.

NOTE: Works only for objects that are read from document opened in reading mode, otherwise an exception is thrown.

Parameters
document document to copy object to.
allowDuplicating indicates if to allow copy objects which already have been copied. If object is associated with any indirect reference and allowDuplicating is false then already existing reference will be returned instead of copying object. If allowDuplicating is true then object will be copied and new indirect reference will be assigned.
copyFilter

iText.Kernel.Utils.ICopyFilter a filter to apply while copying arrays and dictionaries Use iText.Kernel.Utils.NullCopyFilter for no filtering

Returns
copied object.

◆ CopyTo() [4/4]

virtual PdfObject iText.Kernel.Pdf.PdfObject.CopyTo ( PdfDocument  document,
ICopyFilter  copyFilter 
)
inlinevirtual

Copies object to a specified document.

Copies object to a specified document.

NOTE: Works only for objects that are read from document opened in reading mode, otherwise an exception is thrown.

Parameters
document document to copy object to.
copyFilter

iText.Kernel.Utils.ICopyFilter a filter to apply while copying arrays and dictionaries Use iText.Kernel.Utils.NullCopyFilter for no filtering

Returns
copied object.

◆ Flush() [1/2]

void iText.Kernel.Pdf.PdfObject.Flush ( )
inline

Flushes the object to the document.

◆ Flush() [2/2]

void iText.Kernel.Pdf.PdfObject.Flush ( bool  canBeInObjStm )
inline

Flushes the object to the document.

Parameters
canBeInObjStm indicates whether object can be placed into object stream.

◆ GetIndirectReference()

virtual PdfIndirectReference iText.Kernel.Pdf.PdfObject.GetIndirectReference ( )
inlinevirtual

Gets the indirect reference associated with the object.

Gets the indirect reference associated with the object. The indirect reference is used when flushing object to the document.

Returns
indirect reference.

◆ GetObjectType()

◆ IsArray()

virtual bool iText.Kernel.Pdf.PdfObject.IsArray ( )
inlinevirtual

Checks if this PdfObject is of the type PdfArray.

Returns
true or false

◆ IsBoolean()

virtual bool iText.Kernel.Pdf.PdfObject.IsBoolean ( )
inlinevirtual

Checks if this PdfObject is of the type PdfBoolean.

Returns
true or false

◆ IsDictionary()

virtual bool iText.Kernel.Pdf.PdfObject.IsDictionary ( )
inlinevirtual

Checks if this PdfObject is of the type PdfDictionary.

Returns
true or false

◆ IsFlushed()

virtual bool iText.Kernel.Pdf.PdfObject.IsFlushed ( )
inlinevirtual

Indicates is the object has been flushed or not.

Returns
true if object has been flushed, otherwise false.

◆ IsIndirect()

virtual bool iText.Kernel.Pdf.PdfObject.IsIndirect ( )
inlinevirtual

Checks if object is indirect.

Checks if object is indirect.
Note: Return value true doesn't necessarily mean that indirect reference of this object is not null at the moment. Object could be marked as indirect and be transformed to indirect on flushing.
E.g. all PdfStreams are transformed to indirect objects when they are written, but they don't always have indirect references at any given moment.

Returns
returns true if object is indirect or is to be indirect in the resultant document.

◆ IsIndirectReference()

virtual bool iText.Kernel.Pdf.PdfObject.IsIndirectReference ( )
inlinevirtual

Checks if this PdfObject is of the type PdfIndirectReference.

Returns
true if this is an indirect reference, otherwise false

◆ IsLiteral()

virtual bool iText.Kernel.Pdf.PdfObject.IsLiteral ( )
inlinevirtual

Checks if this PdfObject is of the type PdfLiteral.

Returns
true if this is a literal, otherwise false

◆ IsModified()

virtual bool iText.Kernel.Pdf.PdfObject.IsModified ( )
inlinevirtual

Indicates is the object has been set as modified or not.

Indicates is the object has been set as modified or not. Useful for incremental updates (e.g. appendMode).

Returns
true is object has been set as modified, otherwise false.

◆ IsName()

virtual bool iText.Kernel.Pdf.PdfObject.IsName ( )
inlinevirtual

Checks if this PdfObject is of the type PdfName.

Returns
true or false

◆ IsNull()

virtual bool iText.Kernel.Pdf.PdfObject.IsNull ( )
inlinevirtual

Checks if this PdfObject is of the type PdfNull.

Returns
true or false

◆ IsNumber()

virtual bool iText.Kernel.Pdf.PdfObject.IsNumber ( )
inlinevirtual

Checks if this PdfObject is of the type PdfNumber.

Returns
true or false

◆ IsReleaseForbidden()

virtual bool iText.Kernel.Pdf.PdfObject.IsReleaseForbidden ( )
inlinevirtual

Checks if it's forbidden to release this PdfObject instance.

Checks if it's forbidden to release this PdfObject instance. Some objects are vital for the living period of PdfDocument or may be prevented from releasing by high-level entities dealing with the objects. Also it's not possible to release the objects that have been modified.

Returns
true if releasing this object is forbidden, otherwise false

◆ IsStream()

virtual bool iText.Kernel.Pdf.PdfObject.IsStream ( )
inlinevirtual

Checks if this PdfObject is of the type PdfStream.

Returns
true or false

◆ IsString()

virtual bool iText.Kernel.Pdf.PdfObject.IsString ( )
inlinevirtual

Checks if this PdfObject is of the type PdfString.

Returns
true or false

◆ MakeIndirect() [1/2]

virtual PdfObject iText.Kernel.Pdf.PdfObject.MakeIndirect ( PdfDocument  document )
inlinevirtual

Marks object to be saved as indirect.

Parameters
document a document the indirect reference will belong to.
Returns
object itself.

◆ MakeIndirect() [2/2]

virtual PdfObject iText.Kernel.Pdf.PdfObject.MakeIndirect ( PdfDocument  document,
PdfIndirectReference  reference 
)
inlinevirtual

Marks object to be saved as indirect.

Parameters
document a document the indirect reference will belong to.
reference indirect reference which will be associated with this document
Returns
object itself.

Reimplemented in iText.Kernel.Pdf.PdfPrimitiveObject.

◆ NewInstance()

◆ SetModified()

virtual PdfObject iText.Kernel.Pdf.PdfObject.SetModified ( )
inlinevirtual

Sets the 'modified' flag to the indirect object, the flag denotes that the object was modified since the document opening.

Sets the 'modified' flag to the indirect object, the flag denotes that the object was modified since the document opening. It is recommended to set this flag after changing any PDF object.

For example flag is used in the append mode (see StampingProperties.UseAppendMode() ). In append mode the whole document is preserved as is, and only changes to the document are appended to the end of the document file. Because of this, only modified objects need to be flushed and are allowed to be flushed (i.e. to be written).

Returns
this PdfObject instance.

◆ SetState()

virtual PdfObject iText.Kernel.Pdf.PdfObject.SetState ( short  state )
inlinepackagevirtual

Sets special states of current object.

Parameters
state special flag of current object
Returns
this PdfObject

Reimplemented in iText.Kernel.Pdf.PdfIndirectReference.

Member Data Documentation

◆ FLUSHED

const short iText.Kernel.Pdf.PdfObject.FLUSHED = 1
staticpackage

Indicates if the object has been flushed.

◆ FORBID_RELEASE

const short iText.Kernel.Pdf.PdfObject.FORBID_RELEASE = 1 << 7
staticpackage

Indicates that the object is highly sensitive and we do not want to release it even if release() is called.

Indicates that the object is highly sensitive and we do not want to release it even if release() is called. This flag can be set in stamping mode in object wrapper constructors and is automatically set when setModified flag is set (we do not want to release changed objects). The flag is set automatically for some wrappers that need document even in reader mode (FormFields etc).

◆ FREE

const short iText.Kernel.Pdf.PdfObject.FREE = 1 << 1
staticpackage

Indicates that the indirect reference of the object could be reused or have to be marked as free.

◆ indirectReference

PdfIndirectReference iText.Kernel.Pdf.PdfObject.indirectReference = null
package

If object is flushed the indirect reference is kept here.

◆ MODIFIED

const short iText.Kernel.Pdf.PdfObject.MODIFIED = 1 << 3
staticpackage

Indicates that object changed (is used in append mode).

◆ MUST_BE_FLUSHED

const short iText.Kernel.Pdf.PdfObject.MUST_BE_FLUSHED = 1 << 5
staticpackage

For internal usage only.

For internal usage only. Marks objects that shall be written to the output document. Option is needed to build the correct PDF objects tree when closing the document. As a result it avoids writing unused (removed) objects.

◆ MUST_BE_INDIRECT

const short iText.Kernel.Pdf.PdfObject.MUST_BE_INDIRECT = 1 << 6
staticpackage

Indicates that the object shall be indirect when it is written to the document.

Indicates that the object shall be indirect when it is written to the document. It is used to postpone the creation of indirect reference for the objects that shall be indirect, so it is possible to create such objects without PdfDocument instance.

◆ ORIGINAL_OBJECT_STREAM

const short iText.Kernel.Pdf.PdfObject.ORIGINAL_OBJECT_STREAM = 1 << 4
staticpackage

Indicates that the indirect reference of the object represents ObjectStream from original document.

Indicates that the indirect reference of the object represents ObjectStream from original document. When PdfReader read ObjectStream reference marked as OriginalObjectStream to avoid further reusing.

◆ READ_ONLY

const short iText.Kernel.Pdf.PdfObject.READ_ONLY = 1 << 8
staticpackage

Indicates that we do not want this object to be ever written into the resultant document (because of multiple objects read from the same reference inconsistency).

◆ READING

const short iText.Kernel.Pdf.PdfObject.READING = 1 << 2
staticpackage

Indicates that definition of the indirect reference of the object still not found (e.g. keys in XRefStm).

◆ UNENCRYPTED

const short iText.Kernel.Pdf.PdfObject.UNENCRYPTED = 1 << 9
staticpackage

Indicates that this object is not encrypted in the encrypted document.

Indicates that this object is not encrypted in the encrypted document. E.g. digital signature dictionary /Contents entry shall not be encrypted.