Skip to content

PdfDictionary class

View as Markdown

Namespace: PdfNetStack.Objects
Assembly: PdfNetStack.dll
Package: PdfNetStack

A PDF dictionary with keys in insertion order. Keys are names without the leading slash. Most PDF dictionaries hold a handful of keys, so lookups are linear until the dictionary grows, then switch to a hash index.

public sealed class PdfDictionary : PdfObject, IEnumerable<KeyValuePair<string, PdfObject>>, IEnumerable

Inheritance

object ← PdfObject ← PdfDictionary

Implements

IEnumerable<KeyValuePair<string, PdfObject>>, IEnumerable

Creates an empty dictionary.

public PdfDictionary()

Number of entries.

public int Count { get; }

int

The keys, in insertion order.

public IReadOnlyList<string> Keys { get; }

IReadOnlyList<string>

The value for key, or null when absent. The value may be a reference; resolve it through the document. Setting null removes the entry.

public PdfObject? this[string key] { get; set; }

PdfObject?

True when the key is present.

public bool ContainsKey(string key)

key string

bool

Returns an enumerator that iterates through the collection.

public IEnumerator<KeyValuePair<string, PdfObject>> GetEnumerator()

IEnumerator<KeyValuePair<string, PdfObject>>

An enumerator that can be used to iterate through the collection.

The value of key when it is a direct name, without the slash.

public string? GetName(string key)

key string

string?

Removes an entry; returns false when it was absent.

public bool Remove(string key)

key string

bool

Adds or replaces an entry. Replacing keeps the key’s position.

public void Set(string key, PdfObject value)

key string

value PdfObject

Gets the value for key when present.

public bool TryGetValue(string key, out PdfObject value)

key string

value PdfObject

bool