Class PdfArray
A representation of an array as described in the PDF specification.
public class PdfArray : PdfObject, IEnumerable<PdfObject>, IEnumerable
- Inheritance
-
PdfArray
- Implements
- Derived
- Inherited Members
Remarks
A representation of an array as described in the PDF specification. A PdfArray can contain any subclass of PdfObject.
Constructors
PdfArray()
Create a new, empty PdfArray.
public PdfArray()
PdfArray(bool[])
Create a new PdfArray filled with the values in the boolean[] as PdfBoolean.
public PdfArray(bool[] values)
Parameters
values
bool[]values to be added to this PdfArray
PdfArray(IEnumerable<PdfObject>, int)
Create a new PdfArray.
public PdfArray(IEnumerable<PdfObject> objects, int initialCapacity)
Parameters
objects
IEnumerable<PdfObject>List of PdfObjects to be added to this PdfArray
initialCapacity
intInitial capacity of this PdfArray
Remarks
Create a new PdfArray. The PdfObjects in the iterable object will be added to the PdfArray.
PdfArray(IList<string>, bool)
Create a new PdfArray filled with a list of Strings.
public PdfArray(IList<string> strings, bool asNames)
Parameters
strings
IList<string>list of strings to be added to the list
asNames
boolindicates whether the strings should be added as PdfName (true) or as PdfString (false)
Remarks
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).
PdfArray(IList<PdfObject>)
Create a new PdfArray.
public PdfArray(IList<PdfObject> objects)
Parameters
Remarks
Create a new PdfArray. The PdfObjects in the list will be added to the PdfArray.
PdfArray(double[])
Create a new PdfArray filled with the values in the double[] as PdfNumber.
public PdfArray(double[] numbers)
Parameters
numbers
double[]values to be added to this PdfArray
PdfArray(int[])
Create a new PdfArray filled with the values in the int[] as PdfNumber.
public PdfArray(int[] numbers)
Parameters
numbers
int[]values to be added to this PdfArray
PdfArray(float[])
Create a new PdfArray filled with the values in the float[] as PdfNumber.
public PdfArray(float[] numbers)
Parameters
numbers
float[]values to be added to this PdfArray
PdfArray(Rectangle)
Create a new PdfArray.
public PdfArray(Rectangle rectangle)
Parameters
rectangle
RectangleRectangle whose 4 values will be added to the PdfArray
Remarks
Create a new PdfArray. The array is filled with the four values of the Rectangle in the following order: left, bottom, right, top.
PdfArray(PdfArray)
Create a new PdfArray.
public PdfArray(PdfArray arr)
Parameters
arr
PdfArrayPdfArray containing items that will added to this PdfArray
Remarks
Create a new PdfArray. The array is filled with the items of the provided PdfArray.
PdfArray(PdfObject)
Create a new PdfArray with the provided PdfObject as the first item in the array.
public PdfArray(PdfObject obj)
Parameters
obj
PdfObjectfirst item in the array
Fields
list
protected IList<PdfObject> list
Field Value
Methods
Add(int, PdfObject)
Adds the specified PdfObject at the specified index.
public virtual void Add(int index, PdfObject element)
Parameters
Remarks
Adds the specified PdfObject at the specified index. All objects after this index will be shifted by 1.
Add(PdfObject)
public virtual void Add(PdfObject pdfObject)
Parameters
pdfObject
PdfObject
AddAll(ICollection<PdfObject>)
Adds the Collection of PdfObjects.
public virtual void AddAll(ICollection<PdfObject> c)
Parameters
c
ICollection<PdfObject>the Collection of PdfObjects to be added
AddAll(PdfArray)
Adds content of the
PdfArray
.
public virtual void AddAll(PdfArray a)
Parameters
a
PdfArraythe
PdfArray
to be added
Clear()
public virtual void Clear()
Contains(PdfObject)
public virtual bool Contains(PdfObject o)
Parameters
Returns
CopyContent(PdfObject, PdfDocument, ICopyFilter)
protected override void CopyContent(PdfObject from, PdfDocument document, ICopyFilter copyFilter)
Parameters
from
PdfObjectdocument
PdfDocumentcopyFilter
ICopyFilter
Get(int)
Gets the (direct) PdfObject at the specified index.
public virtual PdfObject Get(int index)
Parameters
index
intindex of the PdfObject in the PdfArray
Returns
- PdfObject
the PdfObject at the position in the PdfArray
Get(int, bool)
public virtual PdfObject Get(int index, bool asDirect)
Parameters
Returns
- PdfObject
the element at the specified position in this list
GetAsArray(int)
Returns the element at the specified index as a PdfArray.
public virtual PdfArray GetAsArray(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfArray
the element at the index as a PdfArray
Remarks
Returns the element at the specified index as a PdfArray. If the element isn't a PdfArray, null is returned.
GetAsBoolean(int)
Returns the element at the specified index as a PdfBoolean.
public virtual PdfBoolean GetAsBoolean(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfBoolean
the element at the index as a PdfBoolean
Remarks
Returns the element at the specified index as a PdfBoolean. If the element isn't a PdfBoolean, null is returned.
GetAsDictionary(int)
Returns the element at the specified index as a PdfDictionary.
public virtual PdfDictionary GetAsDictionary(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfDictionary
the element at the index as a PdfDictionary
Remarks
Returns the element at the specified index as a PdfDictionary. If the element isn't a PdfDictionary, null is returned.
GetAsName(int)
Returns the element at the specified index as a PdfName.
public virtual PdfName GetAsName(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfName
the element at the index as a PdfName
Remarks
Returns the element at the specified index as a PdfName. If the element isn't a PdfName, null is returned.
GetAsNumber(int)
Returns the element at the specified index as a PdfNumber.
public virtual PdfNumber GetAsNumber(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfNumber
the element at the index as a PdfNumber
Remarks
Returns the element at the specified index as a PdfNumber. If the element isn't a PdfNumber, null is returned.
GetAsStream(int)
Returns the element at the specified index as a PdfStream.
public virtual PdfStream GetAsStream(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfStream
the element at the index as a PdfStream
Remarks
Returns the element at the specified index as a PdfStream. If the element isn't a PdfStream, null is returned.
GetAsString(int)
Returns the element at the specified index as a PdfString.
public virtual PdfString GetAsString(int index)
Parameters
index
intposition of the element to be returned
Returns
- PdfString
the element at the index as a PdfString
Remarks
Returns the element at the specified index as a PdfString. If the element isn't a PdfString, null is returned.
GetEnumerator()
Returns an iterator over an array of PdfObject elements.
public virtual IEnumerator<PdfObject> GetEnumerator()
Returns
- IEnumerator<PdfObject>
an Iterator.
Remarks
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.
GetObjectType()
public override byte GetObjectType()
Returns
IndexOf(PdfObject)
Gets the first index of the specified PdfObject.
public virtual int IndexOf(PdfObject o)
Parameters
o
PdfObjectPdfObject to find the index of
Returns
- int
index of the PdfObject
IsEmpty()
public virtual bool IsEmpty()
Returns
NewInstance()
protected override PdfObject NewInstance()
Returns
ReleaseContent()
Release content of PdfArray.
protected virtual void ReleaseContent()
Remove(int)
Removes the PdfObject at the specified index.
public virtual void Remove(int index)
Parameters
index
intposition of the PdfObject to be removed
Remove(PdfObject)
Removes the first occurrence of the specified PdfObject, if it is present.
public virtual void Remove(PdfObject o)
Parameters
o
PdfObjecta PdfObject to be removed
Set(int, PdfObject)
Sets the PdfObject at the specified index in the PdfArray.
public virtual PdfObject Set(int index, PdfObject element)
Parameters
Returns
- PdfObject
true if the operation changed the PdfArray
Size()
public virtual int Size()
Returns
SubList(int, int)
Returns a sublist of this PdfArray, starting at fromIndex (inclusive) and ending at toIndex (exclusive).
public virtual IList<PdfObject> SubList(int fromIndex, int toIndex)
Parameters
fromIndex
intthe position of the first element in the sublist (inclusive)
toIndex
intthe position of the last element in the sublist (exclusive)
Returns
ToBooleanArray()
Returns this array as an array of booleans.
public virtual bool[] ToBooleanArray()
Returns
- bool[]
this array as an array of booleans
Remarks
Returns this array as an array of booleans. Will throw a PdfException when it encounters an issue.
ToDoubleArray()
Returns this array as an array of doubles.
public virtual double[] ToDoubleArray()
Returns
- double[]
this array as an array of doubles
Remarks
Returns this array as an array of doubles. Will throw a PdfException when it encounters an issue.
ToFloatArray()
Returns this array as an array of floats.
public virtual float[] ToFloatArray()
Returns
- float[]
this array as an array of floats
Remarks
Returns this array as an array of floats. Will throw a PdfException when it encounters an issue.
ToIntArray()
Returns this array as an array of ints.
public virtual int[] ToIntArray()
Returns
- int[]
this array as an array of ints
Remarks
Returns this array as an array of ints. Will throw a PdfException when it encounters an issue.
ToList()
Returns unmodifiable
public virtual IList<PdfObject> ToList()
Returns
ToLongArray()
Returns this array as an array of longs.
public virtual long[] ToLongArray()
Returns
- long[]
this array as an array of longs
Remarks
Returns this array as an array of longs. Will throw a PdfException when it encounters an issue.
ToRectangle()
Returns the first four elements of this array as a PdfArray.
public virtual Rectangle ToRectangle()
Returns
- Rectangle
Rectangle of the first four values
Remarks
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.
ToString()
public override string ToString()