PDFsharp-net6

ArrayOrSingleItemHelper

Namespace: PdfSharp.Pdf

Provides methods to handle keys that may contain a PdfArray or a single PdfItem.

public class ArrayOrSingleItemHelper

Inheritance ObjectArrayOrSingleItemHelper

Constructors

ArrayOrSingleItemHelper(DictionaryElements)

Initializes ArrayOrSingleItemHelper with PdfDictionary.DictionaryElements to work with.

public ArrayOrSingleItemHelper(DictionaryElements elements)

Parameters

elements DictionaryElements

Methods

Add(String, PdfItem, Boolean)

Adds a PdfItem to the given key. Creates a PdfArray containing the items, if needed.

public void Add(string key, PdfItem value, bool prepend)

Parameters

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.

GetAll(String)

Gets all PdfItems saved in the given key.

public IEnumerable<PdfItem> GetAll(string key)

Parameters

key String
The key in the dictionary to work with.

Returns

IEnumerable<PdfItem>

Get<T>(String, Func<T, Boolean>)

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)

Type Parameters

T

Parameters

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

IEnumerable<T>

Get<T>(String, Object)

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)

Type Parameters

T

Parameters

key String
The key in the dictionary to work with.

value Object
The value, the desired item(s) shall be equal to.

Returns

IEnumerable<T>

Get<T>(String, 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)

Type Parameters

T

Parameters

key String
The key in the dictionary to work with.

value T
The value, the desired item(s) shall be equal to.

Returns

IEnumerable<T>

Contains<T>(String, Func<T, Boolean>)

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)

Type Parameters

T

Parameters

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

Boolean

Contains<T>(String, Object)

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)

Type Parameters

T

Parameters

key String
The key in the dictionary to work with.

value Object
The value, the desired item(s) shall be equal to.

Returns

Boolean

Contains<T>(String, T)

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)

Type Parameters

T

Parameters

key String
The key in the dictionary to work with.

value T
The value, the desired item(s) shall be equal to.

Returns

Boolean

Remove<T>(String, Func<T, Boolean>)

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)

Type Parameters

T

Parameters

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

Boolean

Remove<T>(String, Object)

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)

Type Parameters

T

Parameters

key String
The key in the dictionary to work with.

value Object
The value, the desired item(s) shall be equal to.

Returns

Boolean

Remove<T>(String, T)

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)

Type Parameters

T

Parameters

key String
The key in the dictionary to work with.

value T
The value, the desired item(s) shall be equal to.

Returns

Boolean