DL Logo

PDNameTree Typedefs

PDNameTree

Header: PDExpT.h:5516

Description

The dictionary used to store all of the Named Destinations in a PDF file. A name tree is used to map Cos strings to Cos objects just as a Cos dictionary is used to map Cos names to Cos objects. However, a name tree can have many more entries than a Cos dictionary can. You create a PDNameTree and locate it where you think is appropriate (perhaps under a page, but most often right under the catalog). Name trees use Cos-style strings (not NULL-terminated C strings), which may use Unicode encoding, and these may contain bytes with zeroes in them (high bytes of ASCII characters).

Syntax

typedef OPAQUE_64_BITS PDNameTree;

Returned From

Used By

PDNameTree Functions

PDNameTreeEnum

Header: PDProcs.h:7074

Description

Enumerates the entries in the tree.

Syntax

void PDNameTreeEnum(PDNameTree theTree, CosObjEnumProc proc, void *clientData);

Parameters

theTree
IN/OUT A name tree.
proc
IN/OUT A procedure to call once for each name/object pair in theTree. The obj/value pair in proc correspond to the Cos string and CosObj values of each leaf in the tree.
clientData
IN/OUT Data used by the enumeration procedure. clientData is passed to the enumeration procedure proc each time an entry is encountered.

PDNameTreeEqual

Header: PDProcs.h:7004

Description

Compares two name trees to determine if they are the same object.

Related Methods

Syntax

ASBool PDNameTreeEqual(PDNameTree tree1, PDNameTree tree2);

Parameters

tree1
A name tree.
tree2
Another name tree.

Returns

true if the two name trees are equivalent, false otherwise.

PDNameTreeFromCosObj

Header: PDProcs.h:6966

Description

Creates a type cast of the CosObj to a name tree. This does not copy the object.

Syntax

PDNameTree PDNameTreeFromCosObj(CosObj obj);

Parameters

obj
IN/OUT The CosObj for which a PDNameTree representation is desired.

Returns

A PDNameTree representation of obj.

PDNameTreeGet

Header: PDProcs.h:7039

Description

Retrieves an object from the name tree.

Syntax

ASBool PDNameTreeGet(PDNameTree theTree, const char *name, ASInt32 nameLen, CosObj *value);

Parameters

theTree
The PDNameTree from which an object is retrieved.
name
The name of the object within theTree to get. This is a Cos-style string, not a C string.
nameLen
The length of name.
value
(Filled by the method) The Cos object corresponding to name within theTree.

Returns

true if the object was retrieved, false if no object with this name exists.

PDNameTreeGetCosObj

Header: PDProcs.h:6979

Description

Creates a type cast of the name tree to a CosObj. This does not copy the object.

Syntax

CosObj PDNameTreeGetCosObj(PDNameTree theTree);

Parameters

theTree
IN/OUT The PDNameTree for which a CosObj representation is desired.

Returns

A CosObj representation of theTree.

PDNameTreeIsValid

Header: PDProcs.h:6992

Description

Validates whether a PDNameTree is a CosDict Cos object.

Syntax

ASBool PDNameTreeIsValid(PDNameTree theTree);

Parameters

theTree
The PDNameTree whose validity is desired.

Returns

true if the name tree is a CosDict, false otherwise.

PDNameTreeLookup

Header: PDProcs.h:6216

Description

Given a name tree (such as the Dests tree in the Names dictionary) and a string, find the CosObj in the tree that matches the string.

See the description of Name Trees in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.9.6, page 88.

You can find this document on the web store of the International Standards Organization (ISO).

Syntax

CosObj PDNameTreeLookup(CosObj nameTree, char *string, ASInt32 stringLen);

Parameters

nameTree
The name tree in which to search.
string
The name to search for. The name tree uses Cos-style strings, which may use Unicode encoding, and these may contain bytes with zeroes in them (high bytes of ASCII characters). Note that name is not a C-style string. Cos string objects can contain NULL chars. Standard C string-handling functions may not work as expected.
stringLen
The length of name in bytes.

Returns

The Cos object associated with the specified name, which is the array element following the name.

PDNameTreeNew

Header: PDProcs.h:6953

Description

Creates a new name tree in the document.

Syntax

PDNameTree PDNameTreeNew(PDDoc pdDoc);

Parameters

pdDoc
The document for which a new name tree is desired.

Returns

The newly created name tree or a NULL CosObj if Acrobat is unable to create a PDNameTree for the document specified by pdDoc.

PDNameTreeIsValid() should be called to determine if the name tree returned by PDNameTreeNew() is usable.

PDNameTreeNotifyNameAdded

Header: PDProcs.h:7989

Description

Sends a PDNameTreeNameAdded() notification.

Syntax

void PDNameTreeNotifyNameAdded(PDNameTree theTree, CosObj key, CosObj value);

Parameters

theTree
The PDNameTree to which a name had been added.
key
The name of the object within theTree that was added. This is a Cos string, not a C string.
value
(Filled by the method) The Cos object corresponding to the object name that was added to theTree.

PDNameTreeNotifyNameRemoved

Header: PDProcs.h:8000

Description

Sends a PDNameTreeNameRemoved() notification.

Related Methods

Syntax

void PDNameTreeNotifyNameRemoved(PDNameTree theTree, CosObj removedName);

Parameters

theTree
The PDNameTree from which the name had been removed.
removedName
The name within theTree that was removed.

PDNameTreePut

Header: PDProcs.h:7022

Description

Puts a new entry in the name tree. If an entry with this name is already in the tree, it is replaced.

Related Methods

Syntax

void PDNameTreePut(PDNameTree theTree, CosObj key, CosObj value);

Parameters

theTree
IN/OUT The name tree for which a new entry is added.
key
IN/OUT The name of the object to put in the tree. This is a Cos-style string, not a C string. This allows the use of an existing indirect object for the key rather than forcing the creation of a new object.
value
IN/OUT The Cos object to be associated with key.

PDNameTreeRemove

Header: PDProcs.h:7055

Description

Removes the specified object from the tree. It does nothing if no object with that name exists.

Syntax

void PDNameTreeRemove(PDNameTree theTree, const char *key, ASInt32 keyLen);

Parameters

theTree
IN/OUT The name tree from which an entry is removed.
key
IN/OUT The name of the entry to remove. This is a Cos- style string, not a C string.
keyLen
IN/OUT The length of key in bytes.