PdfIndirectObject Class
Represents an indirect basic PDF object that other PdfBasicObjects can refer to (for example, as an element of an PdfArray or as the value of a PdfDictionary entry).
public sealed class PdfIndirectObject : PdfBasicContainer
Public NotInheritable Class PdfIndirectObject
Inherits PdfBasicContainer
- Inheritance:
- System.ObjectPdfIndirectObject
Properties
Id
Gets the identifier of the current PdfIndirectObject.
public PdfIndirectObjectIdentifier Id { get; }
Public ReadOnly Property Id As PdfIndirectObjectIdentifier
Property Value
The identifier of the current PdfIndirectObject.
ObjectType
Gets the IndirectObject value.
public override PdfBasicObjectType ObjectType { get; }
Public Overrides ReadOnly Property ObjectType As PdfBasicObjectType
Property Value
The IndirectObject value.
Overrides
Value
Gets or sets the value of this PdfIndirectObject.
caution
Set a value only if you are sure that this PdfIndirectObject is not referenced from any other place.
GemBox.Pdf never sets a value of an existing PdfIndirectObject because the PdfIndirectObject might be referenced from several places, instead new PdfIndirectObject is created and its value is set.
Property Value
The value of this PdfIndirectObject.
Exceptions
- System.InvalidOperationException
The current PdfIndirectObject is read-only (IsReadOnly returns true).
- System.ArgumentNullException
value
is null.
- System.ArgumentException
value
is already contained in some other PdfBasicObject or is PdfIndirectObject.
Methods
Clone(Boolean)
Makes a deep clone of the PdfIndirectObject with optionally cloning descendant PdfIndirectObjects.
public PdfIndirectObject Clone(bool shallowIndirect)
Public Function Clone(shallowIndirect As Boolean) As PdfIndirectObject
Parameters
shallowIndirect
- System.Boolean
if set to true descendant PdfIndirectObjects won't be cloned.
Returns
A deep clone of the PdfIndirectObject.
Clone(Func<PdfIndirectObject, PdfBasicObject>)
Makes a deep clone of the PdfIndirectObject with parameter that controls the cloning of PdfIndirectObjects.
public PdfIndirectObject Clone(Func<PdfIndirectObject, PdfBasicObject> indirectObjectClone)
Public Function Clone(indirectObjectClone As Func(Of PdfIndirectObject, PdfBasicObject)) As PdfIndirectObject
Parameters
indirectObjectClone
- System.Func<PdfIndirectObject, PdfBasicObject>
A parameter that controls the cloning of PdfIndirectObjects.
Returns
A deep clone of the PdfIndirectObject.
Create()
Creates a new instance of the PdfIndirectObject class.
Returns
A new instance of the PdfIndirectObject class.
Remarks
GemBox.Pdf assembly doesn't publicly expose constructors for types assignable from PdfObject (except PdfDocument), PdfContentElement, and PdfBasicObject types. These types are instead instantiated either through static Create or other factory methods.
Reasons for this is to support either the current or future extensibility of the type without affecting backward compatibility and without using composition to reduce the number of object allocations.
For example, PdfNumber type is implemented as PdfInteger and internal PdfReal type. When using Create(Double) method, GemBox.Pdf assembly is able to create either PdfReal or PdfInteger, or return a cached instance of PdfInteger available for an implementation-defined interval of integers, thus reducing memory overhead.
PdfString and PdfName types have several internal implementations that reduce the number of System.Array allocations.
PdfArray type is currently implemented as a dynamic array. In the future, GemBox.Pdf assembly might provide an internal implementation that is immutable (without a need to use composition) to reduce memory overhead and optimize cloning operation.
PdfDictionary type is currently implemented as a hash table with a separate chaining collision resolution. In the future, GemBox.Pdf assembly might provide an internal implementation that uses dynamic array (without a need to use composition) if number of entries is small, to reduce memory overhead and, potentially, improve performance.
All these current and future implementations would not be possible in a backward compatible way (without unnecessary usage of composition) if constructors were publicly exposed.
See Also
Create(PdfBasicObject)
Creates a new instance of the PdfIndirectObject class with the specified value.
public static PdfIndirectObject Create(PdfBasicObject value)
Public Shared Function Create(value As PdfBasicObject) As PdfIndirectObject
Parameters
value
- PdfBasicObject
A value that will be contained in the returned PdfIndirectObject.
Returns
A new instance of the PdfIndirectObject class with the specified value.
Remarks
GemBox.Pdf assembly doesn't publicly expose constructors for types assignable from PdfObject (except PdfDocument), PdfContentElement, and PdfBasicObject types. These types are instead instantiated either through static Create or other factory methods.
Reasons for this is to support either the current or future extensibility of the type without affecting backward compatibility and without using composition to reduce the number of object allocations.
For example, PdfNumber type is implemented as PdfInteger and internal PdfReal type. When using Create(Double) method, GemBox.Pdf assembly is able to create either PdfReal or PdfInteger, or return a cached instance of PdfInteger available for an implementation-defined interval of integers, thus reducing memory overhead.
PdfString and PdfName types have several internal implementations that reduce the number of System.Array allocations.
PdfArray type is currently implemented as a dynamic array. In the future, GemBox.Pdf assembly might provide an internal implementation that is immutable (without a need to use composition) to reduce memory overhead and optimize cloning operation.
PdfDictionary type is currently implemented as a hash table with a separate chaining collision resolution. In the future, GemBox.Pdf assembly might provide an internal implementation that uses dynamic array (without a need to use composition) if number of entries is small, to reduce memory overhead and, potentially, improve performance.
All these current and future implementations would not be possible in a backward compatible way (without unnecessary usage of composition) if constructors were publicly exposed.
Exceptions
- System.ArgumentNullException
value
is null.
- System.ArgumentException
value
is already contained in some other PdfBasicObject or is PdfIndirectObject.
See Also
ToString()
Returns a System.String that represents this PdfIndirectObject instance.
Returns
- System.String
A System.String that represents this PdfIndirectObject instance.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).
Inherited Properties
Indirect | Gets the PdfIndirectObject if this PdfBasicContainer is Value or null otherwise. (Inherited from PdfBasicContainer) |
IsReadOnly | Gets a value indicating whether the PdfBasicContainer and all of its descendants are read-only. (Inherited from PdfBasicContainer) |
Null | Gets the single instance of Null type. (Inherited from PdfBasicObject) |
Inherited Methods
Equals(System.Object) | Determines whether the specified System.Object is equal to this PdfBasicContainer instance. (Inherited from PdfBasicContainer) |
GetHashCode() | Returns a hash code for this PdfBasicContainer instance. (Inherited from PdfBasicContainer) |