iText 8.0.4 API
iText.Kernel.Pdf.PdfArray Class Reference

A representation of an array as described in the PDF specification. More...

Inheritance diagram for iText.Kernel.Pdf.PdfArray:
iText.Kernel.Pdf.PdfObject iText.Kernel.Pdf.PdfTextArray

Public Member Functions

  PdfArray ()
  Create a new, empty PdfArray. More...
 
  PdfArray (PdfObject obj)
  Create a new PdfArray with the provided PdfObject as the first item in the array. More...
 
  PdfArray (iText.Kernel.Pdf.PdfArray arr)
  Create a new PdfArray. More...
 
  PdfArray (Rectangle rectangle)
  Create a new PdfArray. More...
 
  PdfArray (IList< PdfObject > objects)
  Create a new PdfArray. More...
 
  PdfArray (float[] numbers)
  Create a new PdfArray filled with the values in the float[] as PdfNumber. More...
 
  PdfArray (double[] numbers)
  Create a new PdfArray filled with the values in the double[] as PdfNumber. More...
 
  PdfArray (int[] numbers)
  Create a new PdfArray filled with the values in the int[] as PdfNumber. More...
 
  PdfArray (bool[] values)
  Create a new PdfArray filled with the values in the boolean[] as PdfBoolean. More...
 
  PdfArray (IList< String > strings, bool asNames)
  Create a new PdfArray filled with a list of Strings. More...
 
  PdfArray (IEnumerable< PdfObject > objects, int initialCapacity)
  Create a new PdfArray. More...
 
virtual int  Size ()
 
virtual bool  IsEmpty ()
 
virtual bool  Contains (PdfObject o)
 
virtual IEnumerator< PdfObject GetEnumerator ()
  Returns an iterator over an array of PdfObject elements. More...
 
virtual void  Add (PdfObject pdfObject)
 
virtual void  Add (int index, PdfObject element)
  Adds the specified PdfObject at the specified index. More...
 
virtual PdfObject  Set (int index, PdfObject element)
  Sets the PdfObject at the specified index in the PdfArray. More...
 
virtual void  AddAll (ICollection< PdfObject > c)
  Adds the Collection of PdfObjects. More...
 
virtual void  AddAll (iText.Kernel.Pdf.PdfArray a)
  Adds content of the PdfArray. More...
 
virtual PdfObject  Get (int index)
  Gets the (direct) PdfObject at the specified index. More...
 
virtual void  Remove (int index)
  Removes the PdfObject at the specified index. More...
 
virtual void  Remove (PdfObject o)
  Removes the first occurrence of the specified PdfObject, if it is present. More...
 
virtual void  Clear ()
 
virtual int  IndexOf (PdfObject o)
  Gets the first index of the specified PdfObject. More...
 
virtual IList< PdfObject SubList (int fromIndex, int toIndex)
  Returns a sublist of this PdfArray, starting at fromIndex (inclusive) and ending at toIndex (exclusive). More...
 
override byte  GetObjectType ()
  Gets object type. More...
 
override String  ToString ()
 
virtual PdfObject  Get (int index, bool asDirect)
 
virtual iText.Kernel.Pdf.PdfArray  GetAsArray (int index)
  Returns the element at the specified index as a PdfArray. More...
 
virtual PdfDictionary  GetAsDictionary (int index)
  Returns the element at the specified index as a PdfDictionary. More...
 
virtual PdfStream  GetAsStream (int index)
  Returns the element at the specified index as a PdfStream. More...
 
virtual PdfNumber  GetAsNumber (int index)
  Returns the element at the specified index as a PdfNumber. More...
 
virtual PdfName  GetAsName (int index)
  Returns the element at the specified index as a PdfName. More...
 
virtual PdfString  GetAsString (int index)
  Returns the element at the specified index as a PdfString. More...
 
virtual PdfBoolean  GetAsBoolean (int index)
  Returns the element at the specified index as a PdfBoolean. More...
 
virtual Rectangle  ToRectangle ()
  Returns the first four elements of this array as a PdfArray. More...
 
virtual float[]  ToFloatArray ()
  Returns this array as an array of floats. More...
 
virtual double[]  ToDoubleArray ()
  Returns this array as an array of doubles. More...
 
virtual long[]  ToLongArray ()
  Returns this array as an array of longs. More...
 
virtual int[]  ToIntArray ()
  Returns this array as an array of ints. More...
 
virtual bool[]  ToBooleanArray ()
  Returns this array as an array of booleans. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObject
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...
 

Additional Inherited Members

- Static Public Attributes inherited from iText.Kernel.Pdf.PdfObject
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
 

Detailed Description

A representation of an array as described in the PDF specification.

A representation of an array as described in the PDF specification. A PdfArray can contain any subclass of PdfObject.

Constructor & Destructor Documentation

◆ PdfArray() [1/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( )
inline

Create a new, empty PdfArray.

◆ PdfArray() [2/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( PdfObject  obj )
inline

Create a new PdfArray with the provided PdfObject as the first item in the array.

Parameters
obj first item in the array

◆ PdfArray() [3/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( iText.Kernel.Pdf.PdfArray  arr )
inline

Create a new PdfArray.

Create a new PdfArray. The array is filled with the items of the provided PdfArray.

Parameters
arr PdfArray containing items that will added to this PdfArray

◆ PdfArray() [4/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( Rectangle  rectangle )
inline

Create a new PdfArray.

Create a new PdfArray. The array is filled with the four values of the Rectangle in the following order: left, bottom, right, top.

Parameters
rectangle Rectangle whose 4 values will be added to the PdfArray

◆ PdfArray() [5/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( IList< PdfObject objects )
inline

Create a new PdfArray.

Create a new PdfArray. The PdfObjects in the list will be added to the PdfArray.

Parameters
objects List of PdfObjects to be added to this PdfArray

◆ PdfArray() [6/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( float[]  numbers )
inline

Create a new PdfArray filled with the values in the float[] as PdfNumber.

Parameters
numbers values to be added to this PdfArray

◆ PdfArray() [7/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( double[]  numbers )
inline

Create a new PdfArray filled with the values in the double[] as PdfNumber.

Parameters
numbers values to be added to this PdfArray

◆ PdfArray() [8/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( int[]  numbers )
inline

Create a new PdfArray filled with the values in the int[] as PdfNumber.

Parameters
numbers values to be added to this PdfArray

◆ PdfArray() [9/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( bool[]  values )
inline

Create a new PdfArray filled with the values in the boolean[] as PdfBoolean.

Parameters
values values to be added to this PdfArray

◆ PdfArray() [10/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( IList< String >  strings,
bool  asNames 
)
inline

Create a new PdfArray filled with a list of Strings.

Create a new PdfArray filled with a list of Strings. The boolean value decides if the Strings should be added as PdfName (true) or as PdfString (false).

Parameters
strings list of strings to be added to the list
asNames indicates whether the strings should be added as PdfName (true) or as PdfString (false)

◆ PdfArray() [11/11]

iText.Kernel.Pdf.PdfArray.PdfArray ( IEnumerable< PdfObject objects,
int  initialCapacity 
)
inline

Create a new PdfArray.

Create a new PdfArray. The PdfObjects in the iterable object will be added to the PdfArray.

Parameters
objects List of PdfObjects to be added to this PdfArray
initialCapacity Initial capacity of this PdfArray

Member Function Documentation

◆ Add()

virtual void iText.Kernel.Pdf.PdfArray.Add ( int  index,
PdfObject  element 
)
inlinevirtual

Adds the specified PdfObject at the specified index.

Adds the specified PdfObject at the specified index. All objects after this index will be shifted by 1.

Parameters
index position to insert the PdfObject
element PdfObject to be added
See also
System.Collections.IList.Add(int, System.Object)

◆ AddAll() [1/2]

virtual void iText.Kernel.Pdf.PdfArray.AddAll ( ICollection< PdfObject c )
inlinevirtual

Adds the Collection of PdfObjects.

Parameters
c the Collection of PdfObjects to be added
See also
System.Collections.IList.AddAll(System.Collections.ICollection)

Reimplemented in iText.Kernel.Pdf.PdfTextArray.

◆ AddAll() [2/2]

virtual void iText.Kernel.Pdf.PdfArray.AddAll ( iText.Kernel.Pdf.PdfArray  a )
inlinevirtual

Adds content of the PdfArray.

Parameters
a the PdfArray to be added
See also
System.Collections.IList.AddAll(System.Collections.ICollection)

◆ Get() [1/2]

virtual PdfObject iText.Kernel.Pdf.PdfArray.Get ( int  index )
inlinevirtual

Gets the (direct) PdfObject at the specified index.

Parameters
index index of the PdfObject in the PdfArray
Returns
the PdfObject at the position in the PdfArray

◆ Get() [2/2]

virtual PdfObject iText.Kernel.Pdf.PdfArray.Get ( int  index,
bool  asDirect 
)
inlinevirtual
Parameters
asDirect true is to extract direct object always.
index index of the element to return
Returns
the element at the specified position in this list

◆ GetAsArray()

virtual iText.Kernel.Pdf.PdfArray iText.Kernel.Pdf.PdfArray.GetAsArray ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfArray.

Returns the element at the specified index as a PdfArray. If the element isn't a PdfArray, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfArray

◆ GetAsBoolean()

virtual PdfBoolean iText.Kernel.Pdf.PdfArray.GetAsBoolean ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfBoolean.

Returns the element at the specified index as a PdfBoolean. If the element isn't a PdfBoolean, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfBoolean

◆ GetAsDictionary()

virtual PdfDictionary iText.Kernel.Pdf.PdfArray.GetAsDictionary ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfDictionary.

Returns the element at the specified index as a PdfDictionary. If the element isn't a PdfDictionary, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfDictionary

◆ GetAsName()

virtual PdfName iText.Kernel.Pdf.PdfArray.GetAsName ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfName.

Returns the element at the specified index as a PdfName. If the element isn't a PdfName, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfName

◆ GetAsNumber()

virtual PdfNumber iText.Kernel.Pdf.PdfArray.GetAsNumber ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfNumber.

Returns the element at the specified index as a PdfNumber. If the element isn't a PdfNumber, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfNumber

◆ GetAsStream()

virtual PdfStream iText.Kernel.Pdf.PdfArray.GetAsStream ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfStream.

Returns the element at the specified index as a PdfStream. If the element isn't a PdfStream, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfStream

◆ GetAsString()

virtual PdfString iText.Kernel.Pdf.PdfArray.GetAsString ( int  index )
inlinevirtual

Returns the element at the specified index as a PdfString.

Returns the element at the specified index as a PdfString. If the element isn't a PdfString, null is returned.

Parameters
index position of the element to be returned
Returns
the element at the index as a PdfString

◆ GetEnumerator()

virtual IEnumerator<PdfObject> iText.Kernel.Pdf.PdfArray.GetEnumerator ( )
inlinevirtual

Returns an iterator over an array of PdfObject elements.

Returns an iterator over an array of PdfObject elements.
NOTE: since 7.0.1 it returns collection of direct objects. If you want to get PdfIndirectReference instances for the indirect objects value, you shall use Get(int, bool) method.

Returns
an Iterator.

◆ GetObjectType()

override byte iText.Kernel.Pdf.PdfArray.GetObjectType ( )
inlinevirtual

Gets object type.

Returns
object type.

Implements iText.Kernel.Pdf.PdfObject.

◆ IndexOf()

virtual int iText.Kernel.Pdf.PdfArray.IndexOf ( PdfObject  o )
inlinevirtual

Gets the first index of the specified PdfObject.

Parameters
o PdfObject to find the index of
Returns
index of the PdfObject
See also
System.Collections.IList.IndexOf(System.Object)

◆ Remove() [1/2]

virtual void iText.Kernel.Pdf.PdfArray.Remove ( int  index )
inlinevirtual

Removes the PdfObject at the specified index.

Parameters
index position of the PdfObject to be removed
See also
System.Collections.IList.JRemoveAt(int)

◆ Remove() [2/2]

virtual void iText.Kernel.Pdf.PdfArray.Remove ( PdfObject  o )
inlinevirtual

Removes the first occurrence of the specified PdfObject, if it is present.

Parameters
o a PdfObject to be removed
See also
System.Collections.IList.Remove(System.Object)

◆ Set()

virtual PdfObject iText.Kernel.Pdf.PdfArray.Set ( int  index,
PdfObject  element 
)
inlinevirtual

Sets the PdfObject at the specified index in the PdfArray.

Parameters
index the position to set the PdfObject
element PdfObject to be added
Returns
true if the operation changed the PdfArray
See also
System.Collections.IList.Set(int, System.Object)

◆ SubList()

virtual IList<PdfObject> iText.Kernel.Pdf.PdfArray.SubList ( int  fromIndex,
int  toIndex 
)
inlinevirtual

Returns a sublist of this PdfArray, starting at fromIndex (inclusive) and ending at toIndex (exclusive).

Parameters
fromIndex the position of the first element in the sublist (inclusive)
toIndex the position of the last element in the sublist (exclusive)
Returns
List of PdfObjects
See also
System.Collections.IList.SubList(int, int)

◆ ToBooleanArray()

virtual bool [] iText.Kernel.Pdf.PdfArray.ToBooleanArray ( )
inlinevirtual

Returns this array as an array of booleans.

Returns this array as an array of booleans. Will throw a PdfException when it encounters an issue.

Returns
this array as an array of booleans

◆ ToDoubleArray()

virtual double [] iText.Kernel.Pdf.PdfArray.ToDoubleArray ( )
inlinevirtual

Returns this array as an array of doubles.

Returns this array as an array of doubles. Will throw a PdfException when it encounters an issue.

Returns
this array as an array of doubles

◆ ToFloatArray()

virtual float [] iText.Kernel.Pdf.PdfArray.ToFloatArray ( )
inlinevirtual

Returns this array as an array of floats.

Returns this array as an array of floats. Will throw a PdfException when it encounters an issue.

Returns
this array as an array of floats

◆ ToIntArray()

virtual int [] iText.Kernel.Pdf.PdfArray.ToIntArray ( )
inlinevirtual

Returns this array as an array of ints.

Returns this array as an array of ints. Will throw a PdfException when it encounters an issue.

Returns
this array as an array of ints

◆ ToLongArray()

virtual long [] iText.Kernel.Pdf.PdfArray.ToLongArray ( )
inlinevirtual

Returns this array as an array of longs.

Returns this array as an array of longs. Will throw a PdfException when it encounters an issue.

Returns
this array as an array of longs

◆ ToRectangle()

virtual Rectangle iText.Kernel.Pdf.PdfArray.ToRectangle ( )
inlinevirtual

Returns the first four elements of this array as a PdfArray.

Returns the first four elements of this array as a PdfArray. The first four values need to be PdfNumbers, if not a PdfException will be thrown.

Returns
Rectangle of the first four values