Class PdfDictionary.DictionaryElements
Represents the interface to the elements of a PDF dictionary.
public sealed class PdfDictionary.DictionaryElements : IDictionary<string, PdfItem?>, ICollection<KeyValuePair<string, PdfItem?>>, IEnumerable<KeyValuePair<string, PdfItem?>>, IEnumerable, ICloneable
- Inheritance
-
PdfDictionary.DictionaryElements
- Implements
- Inherited Members
Properties
ArrayOrSingleItem
Access a key that may contain an array or a single item for working with its value(s).
public ArrayOrSingleItemHelper ArrayOrSingleItem { get; }
Property Value
Count
Gets the number of elements contained in the dictionary.
public int Count { get; }
Property Value
IsFixedSize
Return false.
public bool IsFixedSize { get; }
Property Value
IsReadOnly
Gets a value indicating whether the IDictionary object is read-only.
public bool IsReadOnly { get; }
Property Value
IsSynchronized
Return false.
public bool IsSynchronized { get; }
Property Value
this[PdfName]
Gets or sets an entry in the dictionary identified by a PdfName object.
public PdfItem? this[PdfName key] { get; set; }
Parameters
key
PdfName
Property Value
this[string]
Gets or sets an entry in the dictionary. The specified key must be a valid PDF name starting with a slash '/'. This property provides full access to the elements of the PDF dictionary. Wrong use can lead to errors or corrupt PDF files.
public PdfItem? this[string key] { get; set; }
Parameters
key
string
Property Value
KeyNames
Gets all keys currently in use in this dictionary as an array of PdfName objects.
public PdfName[] KeyNames { get; }
Property Value
- PdfName[]
Keys
Get all keys currently in use in this dictionary as an array of string objects.
public ICollection<string> Keys { get; }
Property Value
SyncRoot
The current implementation returns null.
public object SyncRoot { get; }
Property Value
Values
Gets all values currently in use in this dictionary as an array of PdfItem objects.
public ICollection<PdfItem?> Values { get; }
Property Value
Methods
Add(KeyValuePair<string, PdfItem?>)
Adds an item to the dictionary.
public void Add(KeyValuePair<string, PdfItem?> item)
Parameters
item
KeyValuePair<string, PdfItem>
Add(string, PdfItem?)
Adds the specified value to the dictionary.
public void Add(string key, PdfItem? value)
Parameters
Clear()
Removes all elements from the dictionary.
public void Clear()
Clone()
Creates a shallow copy of this object. The clone is not owned by a dictionary anymore.
public PdfDictionary.DictionaryElements Clone()
Returns
Contains(KeyValuePair<string, PdfItem?>)
Determines whether the dictionary contains a specific value.
public bool Contains(KeyValuePair<string, PdfItem?> item)
Parameters
item
KeyValuePair<string, PdfItem>
Returns
ContainsKey(string)
Determines whether the dictionary contains the specified name.
public bool ContainsKey(string key)
Parameters
key
string
Returns
CopyTo(KeyValuePair<string, PdfItem?>[], int)
Copies the elements of the dictionary to an array, starting at a particular index.
public void CopyTo(KeyValuePair<string, PdfItem?>[] array, int arrayIndex)
Parameters
array
KeyValuePair<string, PdfItem>[]arrayIndex
int
GetArray(string)
Gets the PdfArray with the specified key, or null if no such object exists. If the key refers to a reference, the referenced PdfArray is returned.
public PdfArray? GetArray(string key)
Parameters
key
string
Returns
GetBoolean(string)
Converts the specified value to boolean. If the value does not exist, the function returns false. If the value is not convertible, the function throws an InvalidCastException.
public bool GetBoolean(string key)
Parameters
key
string
Returns
GetBoolean(string, bool)
Converts the specified value to boolean. If the value does not exist, the function returns false. If the value is not convertible, the function throws an InvalidCastException.
public bool GetBoolean(string key, bool create)
Parameters
Returns
GetDateTime(string, DateTime)
Converts the specified value to DateTime. If the value does not exist, the function returns the specified default value. If the value is not convertible, the function throws an InvalidCastException.
public DateTime GetDateTime(string key, DateTime defaultValue)
Parameters
Returns
GetDictionary(string)
Gets the PdfDictionary with the specified key, or null if no such object exists. If the key refers to a reference, the referenced PdfDictionary is returned.
public PdfDictionary? GetDictionary(string key)
Parameters
key
string
Returns
GetEnumerator()
Returns an IDictionaryEnumerator object for the IDictionary object.
public IEnumerator<KeyValuePair<string, PdfItem?>> GetEnumerator()
Returns
GetInteger(string)
Converts the specified value to integer. If the value does not exist, the function returns 0. If the value is not convertible, the function throws an InvalidCastException.
public int GetInteger(string key)
Parameters
key
string
Returns
GetInteger(string, bool)
Converts the specified value to integer. If the value does not exist, the function returns 0. If the value is not convertible, the function throws an InvalidCastException.
public int GetInteger(string key, bool create)
Parameters
Returns
GetMatrix(string)
public XMatrix GetMatrix(string key)
Parameters
key
string
Returns
GetMatrix(string, bool)
public XMatrix GetMatrix(string key, bool create)
Parameters
Returns
GetName(string)
Converts the specified value to a name. If the value does not exist, the function returns the empty string.
public string GetName(string key)
Parameters
key
string
Returns
GetObject(string)
Gets the PdfObject with the specified key, or null if no such object exists. If the key refers to a reference, the referenced PdfObject is returned.
public PdfObject? GetObject(string key)
Parameters
key
string
Returns
GetReal(string)
Converts the specified value to double. If the value does not exist, the function returns 0. If the value is not convertible, the function throws an InvalidCastException.
public double GetReal(string key)
Parameters
key
string
Returns
GetReal(string, bool)
Converts the specified value to double. If the value does not exist, the function returns 0. If the value is not convertible, the function throws an InvalidCastException.
public double GetReal(string key, bool create)
Parameters
Returns
GetRectangle(string)
Converts the specified value to PdfRectangle. If the value does not exist, the function returns an empty rectangle. If the value is not convertible, the function throws an InvalidCastException.
public PdfRectangle GetRectangle(string key)
Parameters
key
string
Returns
GetRectangle(string, bool)
Converts the specified value to PdfRectangle. If the value does not exist, the function returns an empty rectangle. If the value is not convertible, the function throws an InvalidCastException.
public PdfRectangle GetRectangle(string key, bool create)
Parameters
Returns
GetReference(string)
Gets the PdfReference with the specified key, or null if no such object exists.
public PdfReference? GetReference(string key)
Parameters
key
string
Returns
GetString(string)
Converts the specified value to String. If the value does not exist, the function returns the empty string.
public string GetString(string key)
Parameters
key
string
Returns
GetString(string, bool)
Converts the specified value to String. If the value does not exist, the function returns the empty string.
public string GetString(string key, bool create)
Parameters
Returns
GetUnsignedInteger(string)
Converts the specified value to integer. If the value does not exist, the function returns 0. If the value is not convertible, the function throws an InvalidCastException.
public uint GetUnsignedInteger(string key)
Parameters
key
string
Returns
GetUnsignedInteger(string, bool)
Converts the specified value to unsigned integer. If the value does not exist, the function returns 0. If the value is not convertible, the function throws an InvalidCastException.
public uint GetUnsignedInteger(string key, bool create)
Parameters
Returns
GetValue(string)
Short cut for GetValue(key, VCF.None).
public PdfItem? GetValue(string key)
Parameters
key
string
Returns
GetValue(string, VCF)
Gets the value for the specified key. If the value does not exist, it is optionally created.
public PdfItem? GetValue(string key, VCF options)
Parameters
Returns
Remove(KeyValuePair<string, PdfItem?>)
Removes the value with the specified key.
public bool Remove(KeyValuePair<string, PdfItem?> item)
Parameters
item
KeyValuePair<string, PdfItem>
Returns
Remove(string)
Removes the value with the specified key.
public bool Remove(string key)
Parameters
key
string
Returns
SetBoolean(string, bool)
Sets the entry to a direct boolean value.
public void SetBoolean(string key, bool value)
Parameters
SetDateTime(string, DateTime)
Sets the entry to a direct datetime value.
public void SetDateTime(string key, DateTime value)
Parameters
SetInteger(string, int)
Sets the entry to a direct integer value.
public void SetInteger(string key, int value)
Parameters
SetMatrix(string, XMatrix)
Sets the entry to a direct matrix value, represented by an array with six values.
public void SetMatrix(string key, XMatrix matrix)
Parameters
SetName(string, string)
Sets the specified name value. If the value doesn’t start with a slash, it is added automatically.
public void SetName(string key, string value)
Parameters
SetObject(string, PdfObject)
Sets the entry to the specified object. The object must not be an indirect object, otherwise an exception is raised.
public void SetObject(string key, PdfObject obj)
Parameters
SetReal(string, double)
Sets the entry to a direct double value.
public void SetReal(string key, double value)
Parameters
SetRectangle(string, PdfRectangle)
Sets the entry to a direct rectangle value, represented by an array with four values.
public void SetRectangle(string key, PdfRectangle rect)
Parameters
key
stringrect
PdfRectangle
SetReference(string, PdfReference?)
Sets the entry as a reference to the specified iref.
public void SetReference(string key, PdfReference? iref)
Parameters
key
stringiref
PdfReference
SetReference(string, PdfObject)
Sets the entry as a reference to the specified object. The object must be an indirect object, otherwise an exception is raised.
public void SetReference(string key, PdfObject obj)
Parameters
SetString(string, string)
Sets the entry to a direct string value.
public void SetString(string key, string value)
Parameters
SetValue(string, PdfItem)
Sets the entry with the specified value. DON’T USE THIS FUNCTION - IT MAY BE REMOVED.
public void SetValue(string key, PdfItem value)
Parameters
TryGetString(string, out string)
Tries to get the string. TODO: more TryGet...
public bool TryGetString(string key, out string value)
Parameters
Returns
TryGetValue(string, out PdfItem?)
Gets the value associated with the specified key.
public bool TryGetValue(string key, out PdfItem? value)