Namespace: PdfSharp.Pdf
Provides methods to handle keys that may contain a PdfArray or a single PdfItem.
public class ArrayOrSingleItemHelper
Inheritance Object → ArrayOrSingleItemHelper
Initializes ArrayOrSingleItemHelper with PdfDictionary.DictionaryElements to work with.
public ArrayOrSingleItemHelper(DictionaryElements elements)
elements
DictionaryElements
Adds a PdfItem to the given key. Creates a PdfArray containing the items, if needed.
public void Add(string key, PdfItem value, bool prepend)
key
String
The key in the dictionary to work with.
value
PdfItem
The PdfItem to add.
prepend
Boolean
True, if value shall be prepended instead of appended.
Gets all PdfItems saved in the given key.
public IEnumerable<PdfItem> GetAll(string key)
key
String
The key in the dictionary to work with.
Gets the PdfItem(s) of type T saved in the given key, that match a predicate.
public IEnumerable<T> Get<T>(string key, Func<T, bool> predicate)
T
key
String
The key in the dictionary to work with.
predicate
Func<T, Boolean>
The predicate, that shall be true for the desired item(s).
IEnumerable<T>
Gets the PdfItem(s) of type T saved in the given key, that are equal to value.
public IEnumerable<T> Get<T>(string key, object value)
T
key
String
The key in the dictionary to work with.
value
Object
The value, the desired item(s) shall be equal to.
IEnumerable<T>
Gets the PdfItem(s) of type T saved in the given key, that are equal to value.
public IEnumerable<T> Get<T>(string key, T value)
T
key
String
The key in the dictionary to work with.
value
T
The value, the desired item(s) shall be equal to.
IEnumerable<T>
Returns true if the given key contains a PdfItem of type T matching a predicate.
public bool Contains<T>(string key, Func<T, bool> predicate)
T
key
String
The key in the dictionary to work with.
predicate
Func<T, Boolean>
The predicate, that shall be true for the desired item(s).
Returns true if the given key contains a PdfItem of type T, that is equal to value.
public bool Contains<T>(string key, object value)
T
key
String
The key in the dictionary to work with.
value
Object
The value, the desired item(s) shall be equal to.
Returns true if the given key contains a PdfItem of type T, that is equal to value.
public bool Contains<T>(string key, T value)
T
key
String
The key in the dictionary to work with.
value
T
The value, the desired item(s) shall be equal to.
Removes the PdfItem(s) of type T saved in the given key, that match a predicate. Removes the PdfArray, if no longer needed. Returns true if items were removed.
public bool Remove<T>(string key, Func<T, bool> predicate)
T
key
String
The key in the dictionary to work with.
predicate
Func<T, Boolean>
The predicate, that shall be true for the desired item(s).
Removes the PdfItem(s) of type T saved in the given key, that are equal to value. Removes the PdfArray, if no longer needed. Returns true if items were removed.
public bool Remove<T>(string key, object value)
T
key
String
The key in the dictionary to work with.
value
Object
The value, the desired item(s) shall be equal to.
Removes the PdfItem(s) of type T saved in the given key, that are equal to value. Removes the PdfArray, if no longer needed. Returns true if items were removed.
public bool Remove<T>(string key, T value)
T
key
String
The key in the dictionary to work with.
value
T
The value, the desired item(s) shall be equal to.