PDFsharp-net6

PdfNameTreeNode

Namespace: PdfSharp.Pdf

Represents a name tree node.

public sealed class PdfNameTreeNode : PdfDictionary, System.ICloneable, System.Collections.Generic.IEnumerable`1[[System.Collections.Generic.KeyValuePair`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[PdfSharp.Pdf.PdfItem, PdfSharp, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Collections.IEnumerable

Inheritance ObjectPdfItemPdfObjectPdfDictionaryPdfNameTreeNode
Implements ICloneable, IEnumerable<KeyValuePair<String, PdfItem>>, IEnumerable

Properties

Parent

Gets the parent of this node or null if this is the root-node

public PdfNameTreeNode Parent { get; set; }

Property Value

PdfNameTreeNode

IsRoot

Gets a value indicating whether this instance is a root node.

public bool IsRoot { get; }

Property Value

Boolean

KidsCount

Gets the number of Kids elements.

public int KidsCount { get; }

Property Value

Int32

NamesCount

Gets the number of Names elements.

public int NamesCount { get; }

Property Value

Int32

NamesCountTotal

Get the number of names in this node including all children

public int NamesCountTotal { get; }

Property Value

Int32

Kids

public IEnumerable<PdfNameTreeNode> Kids { get; }

Property Value

IEnumerable<PdfNameTreeNode>

LeastKey

Gets the least key.

public string LeastKey { get; }

Property Value

String

GreatestKey

Gets the greatest key.

public string GreatestKey { get; }

Property Value

String

Elements

Gets the dictionary containing the elements of this dictionary.

public DictionaryElements Elements { get; }

Property Value

DictionaryElements

Stream

Gets or sets the PDF stream belonging to this dictionary. Returns null if the dictionary has no stream. To create the stream, call the CreateStream function.

public PdfStream Stream { get; set; }

Property Value

PdfStream

Owner

Gets the PdfDocument this object belongs to.

public PdfDocument Owner { get; }

Property Value

PdfDocument

IsIndirect

Indicates whether the object is an indirect object.

public bool IsIndirect { get; }

Property Value

Boolean

Internals

Gets the PdfInternals object of this document, that grants access to some internal structures which are not part of the public interface of PdfDocument.

public PdfObjectInternals Internals { get; }

Property Value

PdfObjectInternals

Reference

Gets the indirect reference of this object. If the value is null, this object is a direct object.

public PdfReference Reference { get; internal set; }

Property Value

PdfReference

ReferenceNotNull

Gets the indirect reference of this object. Throws if it is null.

public PdfReference ReferenceNotNull { get; }

Property Value

PdfReference

Exceptions

InvalidOperationException
The indirect reference must be not null here.

Constructors

PdfNameTreeNode()

Initializes a new instance of the PdfNameTreeNode class.

public PdfNameTreeNode()

PdfNameTreeNode(PdfDictionary)

Initializes a new instance of the PdfNameTreeNode class.

public PdfNameTreeNode(PdfDictionary dict)

Parameters

dict PdfDictionary

Methods

GetNames(Boolean)

Gets the list of names this node contains

public IReadOnlyList<string> GetNames(bool includeKids)

Parameters

includeKids Boolean
Specifies whether the names of the kids should also be returned

Returns

IReadOnlyList<String>
The list of names this node contains

Remarks:

Note: When kids are included, the names are not guaranteed to be sorted

ContainsName(String, Boolean)

Determines whether this node contains the specified

public bool ContainsName(string name, bool includeKids)

Parameters

name String
The name to search for

includeKids Boolean
Specifies whether the kids should also be searched

Returns

Boolean
true, if this node contains , false otherwise

GetValue(String, Boolean)

Get the value of the item with the specified .
If the value represents a reference, the referenced value is returned.

public PdfItem GetValue(string name, bool includeKids)

Parameters

name String
The name whose value should be retrieved

includeKids Boolean
Specifies whether the kids should also be searched

Returns

PdfItem
The value for when found, otwerwise null

AddKid(PdfNameTreeNode)

Adds a child node to this node.

public void AddKid(PdfNameTreeNode kidNode)

Parameters

kidNode PdfNameTreeNode

AddName(String, PdfItem)

Adds a key/value pair to the Names array of this node.

public void AddName(string key, PdfItem value)

Parameters

key String

value PdfItem

PrepareForSave()

internal void PrepareForSave()

WriteObject(PdfWriter)

internal void WriteObject(PdfWriter writer)

Parameters

writer PdfWriter