Class PdfDictionary
A PDF dictionary. The indexer returns the raw (possibly indirect) value; the typed getters
(GetDictionary(PdfName), GetInt(PdfName, int), ...) resolve references transparently.
Assigning null through the indexer removes the key.
public class PdfDictionary : PdfObject, IEnumerable<KeyValuePair<PdfName, PdfObject>>, IEnumerable
- Inheritance
-
PdfDictionary
- Implements
- Derived
- Inherited Members
Constructors
PdfDictionary()
Creates an empty dictionary.
public PdfDictionary()
PdfDictionary(PdfName)
Creates a dictionary with the /Type entry set to type.
public PdfDictionary(PdfName type)
Parameters
typePdfName
Properties
Count
The number of entries.
public int Count { get; }
Property Value
this[PdfName]
The raw (possibly indirect) value for key, or null if absent. Assigning null
removes the entry.
public PdfObject? this[PdfName key] { get; set; }
Parameters
keyPdfName
Property Value
Keys
The keys of all entries.
public IEnumerable<PdfName> Keys { get; }
Property Value
ObjectType
The kind of this object.
public override PdfObjectType ObjectType { get; }
Property Value
Methods
Clear()
Removes all entries.
public void Clear()
Clone()
Creates a deep copy; references are copied as references (not followed).
public override PdfObject Clone()
Returns
ContainsKey(PdfName)
True if the dictionary has an entry for key.
public bool ContainsKey(PdfName key)
Parameters
keyPdfName
Returns
CopyEntriesTo(PdfDictionary)
Copies deep clones of all entries into target, replacing entries with the same key.
protected void CopyEntriesTo(PdfDictionary target)
Parameters
targetPdfDictionary
Get(PdfName)
Returns the resolved value for key, or null if absent or the null object.
public PdfObject? Get(PdfName key)
Parameters
keyPdfName
Returns
GetArray(PdfName)
Returns the resolved value if it is an array, otherwise null.
public PdfArray? GetArray(PdfName key)
Parameters
keyPdfName
Returns
GetBool(PdfName, bool)
Returns the resolved boolean, or defaultValue if it is missing or not a boolean.
public bool GetBool(PdfName key, bool defaultValue = false)
Parameters
Returns
GetDictionary(PdfName)
Returns the resolved value if it is a dictionary (or stream), otherwise null.
public PdfDictionary? GetDictionary(PdfName key)
Parameters
keyPdfName
Returns
GetDouble(PdfName, double)
Returns the resolved number, or defaultValue if it is missing or not a number.
public double GetDouble(PdfName key, double defaultValue = 0)
Parameters
Returns
GetEnumerator()
Enumerates the entries with their raw (unresolved) values.
public IEnumerator<KeyValuePair<PdfName, PdfObject>> GetEnumerator()
Returns
GetInt(PdfName, int)
Returns the resolved number as int (see IntValue), or defaultValue if it is missing or not a number.
public int GetInt(PdfName key, int defaultValue = 0)
Parameters
Returns
GetLong(PdfName, long)
Returns the resolved number as long (see LongValue), or defaultValue if it is missing or not a number.
public long GetLong(PdfName key, long defaultValue = 0)
Parameters
Returns
GetName(PdfName)
Returns the resolved value if it is a name, otherwise null.
public PdfName? GetName(PdfName key)
Parameters
keyPdfName
Returns
GetNumber(PdfName)
Returns the resolved value if it is a number, otherwise null.
public PdfNumber? GetNumber(PdfName key)
Parameters
keyPdfName
Returns
GetRectangle(PdfName)
Returns the value as normalized rectangle (see ToRectangle()), or null if it is not an array of at least four elements.
public PdfRectangle? GetRectangle(PdfName key)
Parameters
keyPdfName
Returns
GetStream(PdfName)
Returns the resolved value if it is a stream, otherwise null.
public PdfStream? GetStream(PdfName key)
Parameters
keyPdfName
Returns
GetString(PdfName)
Returns the resolved value if it is a string, otherwise null.
public PdfString? GetString(PdfName key)
Parameters
keyPdfName
Returns
GetText(PdfName)
Returns the decoded text of a string value (or the name value of a name).
public string? GetText(PdfName key)
Parameters
keyPdfName
Returns
Get<T>(PdfName)
Returns the resolved value for key if it is a T, otherwise null.
public T? Get<T>(PdfName key) where T : PdfObject
Parameters
keyPdfName
Returns
- T
Type Parameters
T
IsType(PdfName)
Checks the /Type entry.
public bool IsType(PdfName type)
Parameters
typePdfName
Returns
Remove(PdfName)
Removes the entry for key; returns false if there was none.
public bool Remove(PdfName key)
Parameters
keyPdfName
Returns
Set(PdfName, PdfObject?)
Sets the value for key; null removes the entry.
public void Set(PdfName key, PdfObject? value)
Parameters
Set(PdfName, bool)
Sets a boolean value.
public void Set(PdfName key, bool value)
Parameters
Set(PdfName, double)
Sets a real value.
public void Set(PdfName key, double value)
Parameters
Set(PdfName, int)
Sets an integer value.
public void Set(PdfName key, int value)
Parameters
Set(PdfName, long)
Sets an integer value.
public void Set(PdfName key, long value)
Parameters
SetName(PdfName, string?)
Sets a name value (a leading slash is ignored); null removes the entry.
public void SetName(PdfName key, string? value)
Parameters
SetText(PdfName, string?)
Sets a text string value.
public void SetText(PdfName key, string? value)