DL Logo

PDSElement Typedefs

PDSElement

Header: PDSExpT.h:83

Description

Represents PDF structural elements, which are nodes in a tree giving a PDF document's logical structure.

Syntax

typedef CosObj PDSElement;

Returned From

Used By

PDSElement Callback Signatures

EnumElementsWithUserPropertiesProc

Header: PDSExpT.h:253

Description

A callback for PDDocEnumPDSElementsWithUserProperties() and PDSElementEnumKidsWithUserProperties().

Syntax

ASBool EnumElementsWithUserPropertiesProc(PDSElement elem, PDSElement closestAncestorWithUserProperties, void *clientData);

Parameters

elem
A PDS element that contains user properties, attributes, and classes.
closestAncestorWithUserProperties
The nearest PDS element above elem in the structure tree that also contains user properties, attributes, and classes, or CosNewNull() if no such element exists.
clientData

Returns

true to continue enumeration, false to halt.

Used By

PDSElementEnumUserPropertiesAsASTextProc

Header: PDSExpT.h:228

Description

Callback for PDSElementEnumUserPropertiesAsASText().

Syntax

ASBool PDSElementEnumUserPropertiesAsASTextProc(ASText propName, ASText propVal, void *clientData);

Parameters

propName
The property's name.
propVal
The property's value, formatted for display.
clientData
Client-supplied data passed in to PDSElementEnumUserPropertiesAsASText().

Returns

true to continue enumeration, false to halt.

Used By

PDSElementEnumUserPropertiesAsCosObjProc

Header: PDSExpT.h:239

Description

A callback for PDSElementEnumUserPropertiesAsCosObj().

Syntax

ASBool PDSElementEnumUserPropertiesAsCosObjProc(CosObj propDict, void *clientData);

Parameters

propDict
The property dictionary, containing the property's name and its value.
clientData
Client-supplied data passed in to PDSElementEnumUserPropertiesAsASText().

Returns

true to continue enumeration, false to halt.

Used By

PDSElement Structures

_t_PDUserPropertiesXMLLabels

Header: PDSExpT.h:273

Description

Information about XML labels for exporting user properties.
Tag
Name
nodeTag
"xyz_Node"
nodeNameTag
"xyz_NodeName"
propTag
"xyz_Property"
propNameTag
"xyz_PropertyName"
propValTag
"xyz_Value"

Syntax

struct _t_PDUserPropertiesXMLLabels {
ASSize_t size;
ASText rootTag;
ASText nodeTag;
ASText propTag;
ASText classTag;
ASText classDefTag;
ASText nodeNameTag;
ASText propNameTag;
ASText propValueTag;
ASText propTypeTag;
ASText propFormatTag;
ASText propHiddenTag;
ASText classNameTag;
ASText classDefNameTag;
} *PDUserPropertiesXMLLabels;

Used By

PDSElement Functions

PDDocEnumPDSElementsWithUserProperties

Header: PDSReadProcs.h:847

Description

Enumerates the elements in the document's structure tree that have UserProperties attributes or classes, calling the supplied enumeration procedure for each such element found. The procedure returns true to continue enumeration, or false to halt enumeration.

Syntax

ASBool PDDocEnumPDSElementsWithUserProperties(PDDoc doc, EnumElementsWithUserPropertiesProc proc, void *clientData);

Parameters

doc
The PDDoc whose structure elements are to be enumerated.
proc
The procedure to call for each PDSElement found to have UserProperties.
clientData
Client-supplied data to be passed to the client callback.

Returns

true if the enumeration completes, false if the enumeration callback returns false.

PDDocHasUserProperties

Header: PDSReadProcs.h:831

Description

Returns true if the document declares that it has structure elements that conform to the UserProperties attributes or class conventions.

This is based on both the presence of StructTreeRoot, and a value of "true" for the UserProperties key in the document's MarkInfo dictionary.

Syntax

ASBool PDDocHasUserProperties(PDDoc doc);

Parameters

doc
The PDDoc to be examined.

Returns

An ASBool indicating whether the document declares that it has structure elements with UserProperties attributes or classes.

PDSElementAddAttrObj

Header: PDSWriteProcs.h:258

Description

Associates the specified attribute object with an element at the element's current revision value.

This may raise various exceptions.

Syntax

void PDSElementAddAttrObj(IN PDSElement element, IN PDSAttrObj attrObj);

Parameters

element
The element with which attrObj is associated.
attrObj
The attribute object to associate with element.

PDSElementAddClass

Header: PDSWriteProcs.h:311

Description

Adds a class name to the element's list of classes to which it belongs at the element's current revision value.

This may raise various exceptions.

Syntax

void PDSElementAddClass(IN PDSElement element, IN ASAtom classAtom);

Parameters

element
IN/OUT The element to which a class is added.
classAtom
IN/OUT The ASAtom representing the class to add to element. If classAtom is already present among the element parameter's classes, it will not be added again.

PDSElementClearID

Header: PDSWriteProcs.h:560

Description

Removes an element's ID, if it exists.

Syntax

void PDSElementClearID(IN PDSElement element);

Parameters

element
The element whose ID is removed.

Exceptions

is raised if element is not a valid PDSElement.
is raised if an error is found in the PDF file.

PDSElementCreate

Header: PDSWriteProcs.h:200

Description

Creates a new (but empty) PDSElement.

This may raise various exceptions.

Syntax

void PDSElementCreate(IN PDDoc pdDoc, OUT PDSElement *element);

Parameters

pdDoc
The PDDoc in which the PDSElement is created.
element
(Filled by the method) The newly created PDSElement.

PDSElementEnumKidsWithUserProperties

Header: PDSReadProcs.h:942

Description

Enumerates PDSElement objects, beneath the supplied PDSElement, that have user properties attributes/classes.

The elements in a structure tree that have user properties form a virtual tree themselves; this procedure enumerates the children of the given structure element in this virtual tree. In other words, this procedure enumerates all the descendents( d) of the supplied structure element( e) such that PDSElementFindAncestorWithUserProperties(d) would return ( e). The enumeration continues as long as the callback returns true, and halts when the proc returns false or all virtual children have been enumerated.

Syntax

ASBool PDSElementEnumKidsWithUserProperties(PDSElement elem, EnumElementsWithUserPropertiesProc proc, void *clientData);

Parameters

elem
The PDSElement below which to search for elements with user properties.
proc
The client-supplied callback to call for each element found.
clientData
Client-supplied data to be passed to the client callback.

Returns

true if the enumeration completes, false if the enumeration callback returns false.

PDSElementEnumUserPropertiesAsASText

Header: PDSReadProcs.h:879

Description

Enumerates the PDSElement object's user properties by traversing the list of attribute objects and class objects, calling the caller-supplied procedure for each entry in the properties array. The enumeration proc receives the property information as a pair of ASText objects, for the property name and the property value. The enumeration continues as long as the callback returns true, and halts when the proc returns false or all properties have been enumerated.

Syntax

ASBool PDSElementEnumUserPropertiesAsASText(PDSElement elem, PDSElementEnumUserPropertiesAsASTextProc proc, void *clientData, ASBool includeHidden);

Parameters

elem
The PDSElement whose user properties will be enumerated.
proc
The callback that is called for each user property item.
clientData
Client-supplied data to be passed to the client callback.
includeHidden
A boolean value indicating whether the client wants to be given property items that are marked as hidden.

Returns

true if the enumeration completes, false if the enumeration callback returns false.

PDSElementEnumUserPropertiesAsCosObj

Header: PDSReadProcs.h:903

Description

Enumerates the PDSElement object's user properties by traversing the list of attribute objects and class objects, calling the caller-supplied procedure for each entry in the properties array. The enumeration proc receives the property information as a Cos Dictionary. See the description of objects in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.3, page 13.

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

The enumeration continues as long as the callback returns true, and halts when the proc returns false or all properties have been enumerated.

Syntax

ASBool PDSElementEnumUserPropertiesAsCosObj(PDSElement elem, PDSElementEnumUserPropertiesAsCosObjProc proc, void *clientData, ASBool includeHidden);

Parameters

elem
The PDSElement whose user properties will be enumerated.
proc
The callback that is called for each user property item.
clientData
Client-supplied data to be passed to the client callback.
includeHidden
A boolean value indicating whether the client wants to be given property items that are marked as hidden.

Returns

true if the enumeration completes, false if the enumeration callback returns false.

PDSElementExportUserProperties

Header: PDSReadProcs.h:1019

Description

Exports user properties of the specified PDSElement in XML.

Syntax

ASErrorCode PDSElementExportUserProperties(PDSElement userPropsElement, ASBool wholeSubtree, ASBool includeHidden, ASBool flattenClasses, PDUserPropertiesXMLLabels xmlLabels, ASStm output);

Parameters

userPropsElement
The element whose user properties are to be exported in XML format.
wholeSubtree
A boolean value indicating whether to export user properties of the whole structure tree which contains userPropsElement, or just the subtree which starts from userPropsElement.
includeHidden
A boolean value indicating whether the client wants to be given property items that are marked as hidden.
flattenClasses
A boolean value indicating whether to flatten the attribute classes for each structure element. If true, the user properties for that class will be listed as properties for that stucture element. If false, the class will be listed for that structure element, and a list of classes and their properties will be listed near the end of the XML.
xmlLabels
The XML tag/label information for exporting user properties. These labels are output as is. There is no XML escaping done. It is the caller's responsibility to make sure they conform to the XML standard.
output
The output stream to which user properties are written. The encoding of the characters is UTF-8.

Returns

An ASErrorCode to indicate the success of exporting user properties in XML format. If ASErrorCode is 0, it indicates success in exporting user properties; non-zero value indicates otherwise.

PDSElementFindAncestorWithUserProperties

Header: PDSReadProcs.h:918

Description

Starting at the supplied structure element, this procedure follows the chain of parents (see PDSElementGetParent()) until a structure element is found that has user properties. If no such element is found (for example, the chain ended at the structure tree root), CosNull is returned.

Syntax

PDSElement PDSElementFindAncestorWithUserProperties(PDSElement elem);

Parameters

elem
The PDSElement at which to start searching upwards through the tree.

Returns

The first ancestor of elem that contains UserProperties attributes or class information, or CosNull if none is found.

PDSElementGetActualText

Header: PDSReadProcs.h:658

Description

Gets the actual text associated with the specified PDSElement. It returns the number of bytes in the text, or 0 if the element has no actual text or has an empty string.

To check for the existence of alternate text, check for a non-zero return value. To get the needed size of buffer, call this method with a NULL buffer.

Note: Due to implementation issues, make the buffer one byte larger than the required size. Code will not NULL-terminate the string correctly in the case of Unicode strings.

Related Methods

Syntax

ASInt32 PDSElementGetActualText(IN PDSElement element, IN ASUns8 *buffer);

Parameters

element
The structural element whose actual text is sought.
buffer
If not NULL, buffer contains the element's actual text. The string is NULL-terminated (but not correctly for Unicode). This is not a C-style string, so normal string handling functions may not work; the buffer may contain a Unicode string.

Returns

An ASInt32 representing the number of bytes in the text, or 0 if the element has no actual text.

PDSElementGetActualTextASText

Header: PDSReadProcs.h:973

Description

Gets the actual text associated with the specified PDSElement as an ASText object.

Syntax

void PDSElementGetActualTextASText(PDSElement element, ASText text);

Parameters

element
The element whose actual text is sought.
text
(Filled by the method) The text object containing the element's actual text. The client must pass a valid ASText object. The routine does not allocate it.

PDSElementGetAlt

Header: PDSReadProcs.h:329

Description

Gets the alternate text associated with an element.

It can first be called with a NULL buffer to find the size, so that buffer can then be appropriately sized.

Note: The Alt text can be legally defined as an empty string. To differentiate between an Alt text string of zero length and no Alt text being defined, call PDSElementHasAlt() first.

Note: Due to implementation issues, make the buffer one byte larger than the required size. The code will not NULL-terminate the string correctly in the case of Unicode strings.

Syntax

ASInt32 PDSElementGetAlt(IN PDSElement element, IN ASUns8 *buffer);

Parameters

element
The element whose alternate text is obtained.
buffer
(Filled by the method) A buffer into which the alternate text is placed. It may be NULL, if the method is called only to find the length of the element's alternate text. If it is not NULL, buffer contains the element's actual text. The string is NULL-terminated (but not correctly for Unicode). This is not a C-style string, so normal string handling functions may not work; the buffer may contain a Unicode string.

Returns

The number of bytes in the element parameter's alternate text.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetAltASText

Header: PDSReadProcs.h:991

Description

Gets the alternate text associated with the specified PDSElement as an ASText object.

Syntax

void PDSElementGetAltASText(PDSElement element, ASText text);

Parameters

element
The element whose alternate text is sought.
text
(Filled by the method) The text object containing the element's alternate text. The client must pass a valid ASText object. The routine does not allocate it.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetAttrObj

Header: PDSReadProcs.h:261

Description

Gets the attribute object at a specified array index in the specified element.

If there is only one attribute object (that is, there is no array of attributes), and index is zero, that attribute object is obtained.

Syntax

ASInt32 PDSElementGetAttrObj(IN PDSElement element, IN ASInt32 index, OUT PDSAttrObj *attrObj);

Parameters

element
IN/OUT The element whose attribute is obtained.
index
IN/OUT The index of the attribute object to obtain.
attrObj
IN/OUT (Filled by the method) The attribute object at index.

Returns

The revision number of element at time of last association.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetClass

Header: PDSReadProcs.h:297

Description

Gets the class name at an array index in the specified element.

If there is only one attribute object (that is, there is no array), and index is zero, that class name is obtained.

Syntax

ASInt32 PDSElementGetClass(IN PDSElement element, IN ASInt32 index, OUT ASAtom *classAtom);

Parameters

element
The element whose class is obtained.
index
The index of the class to obtain.
classAtom
(Filled by the method) The ASAtom describing the class.

Returns

The revision number of element at the time of the last association.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetCosObj

Header: PDSReadProcs.h:806

Description

Gets the Cos object corresponding to the specified element object. This method does not copy the object, but is instead the logical equivalent of a type cast.

Syntax

CosObj PDSElementGetCosObj(PDSElement element);

Parameters

element
The element object whose Cos object is obtained.

Returns

The dictionary Cos object for the element object.

PDSElementGetFirstPage

Header: PDSReadProcs.h:427

Description

Gets the Cos object for the page of the first kid of the element.

This may throw various exceptions.

Note: The order in which the returned page is first is the order of kids, not the order of pages. That is, the first descendant with page content determines which page is returned.

Related Methods

Syntax

CosObj PDSElementGetFirstPage(IN PDSElement pdsElement, OUT ASAtom *firstKidType, OUT CosObj *firstCosObjKidOnAPage, OUT PDEContainer *firstMCKidOnAPage);

Parameters

pdsElement
IN/OUT The element whose kid's first page is found.
firstKidType
IN/OUT (Filled by the method) A pointer to an ASAtom for the name that appears as the Type entry of the actual first kid of element. Possible values are the values that PDSElementGetKid() can return. Pass NULL to inhibit setting firstKidType.
firstCosObjKidOnAPage
IN/OUT (Filled by the method) The kid whose content determined that the page returned was the first page with content, if that kid is a CosObj. Pass NULL to inhibit setting firstCosObjKidOnAPage.
firstMCKidOnAPage
IN/OUT (Filled by the method) The kid whose content determined that the page returned was the first page with content, if that kid is marked content that is not a CosObj. Pass NULL to inhibit setting firstMCKidOnAPage.

Returns

The CosObj of the page found, CosObjNull if the element has no page content.

PDSElementGetID

Header: PDSReadProcs.h:448

Description

Gets the ID of an element, or CosObjNull if there is no ID set.

Syntax

ASInt32 PDSElementGetID(IN PDSElement pdsElement, OUT ASUns8 *idBuf);

Parameters

pdsElement
The element whose ID is obtained.
idBuf
(Filled by the method) A pointer to the buffer containing the element's ID.

Returns

The number of bytes in the ID, or zero if the element has no ID.

Exceptions

is raised if element is not a valid PDSElement.
is raised if an error is found in the PDF file.

PDSElementGetKid

Header: PDSReadProcs.h:393

Description

Gets the kid at an array index in the specified element.

A PDF structural element, unlike the structure tree root, can have several different kinds of children: marked content, another element, or an entire PDF object. The parameter in which the kid is placed depends on the type of kid. If the kid is a structural element or an object reference, PDSElementGetKid() places the result in cosObjKid; if the kid is page content, it is placed in pointerKid.

Any or all of cosObjKid, pointerKid, and cosPage can be NULL to get the kid's type without setting that parameter.

Note: When the kid is an MC, it is actually a pointer of the type PDEContainer. As with all PDFEdit objects, you must be careful to manage the reference count of the object by calling PDEAcquire() and PDERelease(). PDSElementGetKid() does not call PDEAcquire() for you.

Note: This method cannot access marked content inside a Form XObject.

Syntax

ASAtom PDSElementGetKid(IN PDSElement element, IN ASInt32 index, OUT CosObj *cosObjKid, OUT void **pointerKid, OUT CosObj *cosPage);

Parameters

element
The element whose specified kid is found.
index
The index of the kid to obtain.
cosObjKid
(Filled by the method) The CosObj of the specified kid, if that kid is a PDSElement or an OBJR. If cosObjKid is NULL, it is not filled in, but the type of the kid is returned regardless. Note that this CosObj can be treated as a PDSElement or a PDSObjR. Use the return type to decide which to use.
pointerKid
(Filled by the method) A pointer to the kid at index, if that kid is an MC. If pointerKid is NULL, it is not filled in, but the type of the kid is returned regardless.
cosPage
(Filled by the method) A pointer to the CosObj of the page containing the kid. If cosPage is NULL, it is not filled in, but the type of the kid is returned regardless.

Returns

The ASAtom representing the kid's Type value: StructElem, MC, or OBJR. MCR is never returned.

Exceptions

is raised if element is not a valid PDSElement.
is raised if an error is found in the PDF file.

PDSElementGetKidEx

Header: PDSReadProcs.h:630

Description

Functions identically to PDSElementGetKid(), but for children that are marked contents can return the mcid as well as or instead of the actual object.

Note: This method cannot access marked content inside a Form XObject.

Syntax

ASAtom PDSElementGetKidEx(IN PDSElement element, IN ASInt32 index, OUT CosObj *cosObjKid, OUT ASInt32 *mcid, OUT void **pointerKid, OUT CosObj *cosPage);

Parameters

element
The PDSElement containing the kid that is retrieved.
index
The index of the kid.
cosObjKid
(Filled in by method) The kid being accessed (depending on the kid's type) or NULL.
mcid
(Filled in by method) The kid's mcid or NULL.
pointerKid
(Filled in by method) A pointer to the kid, or NULL.
cosPage
(Filled in by method) The CosObj of the page containing the kid, or NULL.

Returns

An ASAtom representing the Type value of the kid. See above.

Exceptions

is raised if element is not a valid PDSElement.
is raised if an error is found in the PDF file.

PDSElementGetKidWithMCInfo

Header: PDSReadProcs.h:745

Description

Functions identically to PDSElementGetKidEx(), but returns additional information about marked content kids that are in streams other than the page content streams.

Syntax

ASAtom PDSElementGetKidWithMCInfo(PDSElement element, ASInt32 index, CosObj *cosObjKid, PDSMCInfoP mcidInfo, void **pointerKid, CosObj *cosPage);

Parameters

element
The PDSElement containing the kid that is retrieved.
index
The index of the kid.
cosObjKid
(Filled in by method) The kid being accessed (depending on the kid's type), or NULL.
mcidInfo
(Filled in by method) The kid's information object, or NULL.
pointerKid
(Filled in by method) A pointer to the kid, or NULL.
cosPage
(Filled in by method) The CosObj of the page containing the kid, or NULL.

Returns

An ASAtom representing the Type value of the kid.

Exceptions

is raised if element is not a valid PDSElement.
is raised if an error is found in the PDF file.

PDSElementGetLanguage

Header: PDSReadProcs.h:688

Description

Gets the language associated with the specified PDSElement.

It returns the number of bytes in the language string, or 0 if the element has no language or has an empty string.

To check for the existence of expansion text, call PDSElementHasLanguage(). To get the needed buffer size, call this method with a NULL buffer.

Note: Due to implementation issues, make the buffer one byte larger than the required size. Code will not NULL-terminate the string correctly in the case of Unicode strings.

Syntax

ASInt32 PDSElementGetLanguage(IN PDSElement element, IN ASUns8 *buffer);

Parameters

element
The structural element whose expansion text is sought.
buffer
(Filled by the method) A buffer containing the element's expansion text, or NULL. See PDSElementSetLanguage() for format and languages. If not NULL, buffer contains the element's expansion text. The string is NULL-terminated (but not correctly for Unicode). This is not a C-style string, so normal string handling functions may not work; the buffer may contain a Unicode string.

Returns

An ASInt32 representing the number of bytes in the language string.

PDSElementGetNumAttrObjs

Header: PDSReadProcs.h:236

Description

Gets the number of attribute objects directly attached to the specified element.

Related Methods

Syntax

ASInt32 PDSElementGetNumAttrObjs(IN PDSElement element);

Parameters

element
IN/OUT The element whose number of attributes is obtained.

Returns

The number of attribute objects directly attached to element.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetNumClasses

Header: PDSReadProcs.h:274

Description

Gets the number of classes to which the specified element belongs.

Related Methods

Syntax

ASInt32 PDSElementGetNumClasses(IN PDSElement element);

Parameters

element
The element whose number of classes is obtained.

Returns

The number of classes to which element belongs.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetNumKids

Header: PDSReadProcs.h:341

Description

Gets the number of kids of the specified element.

Related Methods

Syntax

ASInt32 PDSElementGetNumKids(IN PDSElement element);

Parameters

element
IN/OUT The element whose number of kids is obtained.

Returns

The number of direct kids of element.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetParent

Header: PDSReadProcs.h:187

Description

Gets the immediate ancestor element of the specified element in the tree.

If the element's parent is another element, parent is set to that parent and parentIsTreeRoot is set to false. If the element's parent is the structure tree root, parent is set to CosNull and parentIsTreeRoot is set to true. If parentIsTreeRoot is NULL, it is not set.

Syntax

void PDSElementGetParent(IN PDSElement element, OUT PDSElement *parent, OUT ASBool *parentIsTreeRoot);

Parameters

element
The element whose parent is obtained.
parent
(Filled by the method) The element's parent.
parentIsTreeRoot
(Filled by the method) The element's parent is the structure tree root.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetRevision

Header: PDSReadProcs.h:222

Description

Gets the revision number of an element.

Syntax

ASInt32 PDSElementGetRevision(IN PDSElement element);

Parameters

element
IN/OUT The element whose revision is obtained.

Returns

The revision number of element.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetStructTreeRoot

Header: PDSReadProcs.h:464

Description

Gets the structure tree root of the document containing element.

Related Methods

Syntax

ASBool PDSElementGetStructTreeRoot(IN PDSElement element, OUT PDSTreeRoot *treeRoot);

Parameters

element
The element whose title is obtained.
treeRoot
(Filled by the method) The structure tree root.

Returns

true if the document has a structure tree root, false otherwise. If there is a structure tree root, it sets treeRoot to be the structure tree root.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetTitle

Header: PDSReadProcs.h:210

Description

Gets the title of the specified element, returning the number of bytes in the title.

It can first be called with a NULL buffer to find the title size, so that buffer can be appropriately sized as one greater than the title's length.

Note: Due to implementation issues, make the buffer one byte larger than the required size.

Related Methods

Syntax

ASInt32 PDSElementGetTitle(IN PDSElement element, OUT ASUns8 *buffer);

Parameters

element
IN/OUT The element whose title is obtained.
buffer
IN/OUT (Filled by the method) A buffer into which the title text is placed. It may be NULL, in which case the number of bytes in the title is returned.

Returns

The number of bytes in the element parameter's title, or zero if element has no title.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetTitleASText

Header: PDSReadProcs.h:959

Description

Gets the title associated with the specified PDSElement as an ASText object.

Syntax

void PDSElementGetTitleASText(PDSElement element, ASText title);

Parameters

element
The element whose title is sought.
title
(Filled by the method) The text object containing the title. The client must pass a valid ASText object. The routine does not allocate it.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementGetType

Header: PDSReadProcs.h:162

Description

Gets the element's structural element type. The type corresponds to the Subtype key in the structure element dictionary.

PDSElementGetType() gets the value of the Subtype key (not the Type key) in the structure element dictionary. All PDSElement objects have a Type value of StructElem.

Related Methods

Syntax

ASAtom PDSElementGetType(IN PDSElement element);

Parameters

element
The element whose structural element type is obtained.

Returns

The ASAtom representing element's type.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementHasActualText

Header: PDSReadProcs.h:709

Description

Tests whether ActualText is defined for a given PDSElement.

Syntax

ASBool PDSElementHasActualText(IN PDSElement element);

Parameters

element
The PDSElement being tested.

Returns

true if text exists (including the empty string); false otherwise.

PDSElementHasAlt

Header: PDSReadProcs.h:699

Description

Tests whether Alt text is defined for a given PDSElement.

Related Methods

Syntax

ASBool PDSElementHasAlt(IN PDSElement element);

Parameters

element
The PDSElement being tested.

Returns

true if text exists (including the empty string); false otherwise.

PDSElementHasLanguage

Header: PDSReadProcs.h:719

Description

Tests whether a language string is defined for a given PDSElement.

Syntax

ASBool PDSElementHasLanguage(IN PDSElement element);

Parameters

element
The PDSElement being tested.

Returns

true if text exists (including the empty string); false otherwise.

PDSElementHasUserProperties

Header: PDSReadProcs.h:858

Description

Returns true if the PDSElement has attribute objects or class objects with an owner of UserProperties.

Syntax

ASBool PDSElementHasUserProperties(PDSElement elem);

Parameters

elem
The PDSElement to examine.

Returns

ASBool indicating that some attribute objects or class objects have an owner of UserProperties.

PDSElementIncrementRevision

Header: PDSWriteProcs.h:243

Description

Increments an element's revision count by one.

This may raise various exceptions.

Syntax

void PDSElementIncrementRevision(IN PDSElement element);

Parameters

element
The element whose revision count is incremented.

PDSElementInsertKid

Header: PDSWriteProcs.h:389

Description

Inserts the specified kid PDSElement object into the specified element after position insertAfter.

Syntax

void PDSElementInsertKid(IN PDSElement element, IN PDSElement kid, IN ASInt32 insertAfter);

Parameters

element
The element in which the specified kid is inserted.
kid
The kid to insert.
insertAfter
The position after which the kid is inserted. If element currently has no kids, insertAfter is ignored.

Exceptions

PDSElementInsertMCAsKid

Header: PDSWriteProcs.h:413

Description

Inserts a reference to the specified PDSMC (marked content) in the specified element after position insertAfter.

This method automatically creates MCR objects if needed.

This may raise various exceptions.

Syntax

void PDSElementInsertMCAsKid(IN PDSElement element, IN CosObj cosPage, IN PDSMC mc, IN ASInt32 insertAfter);

Parameters

element
The element in which the reference is inserted.
cosPage
The CosObj for the page containing the reference to insert.
mc
The marked content to insert.
insertAfter
The position after which the reference is inserted. If element currently has no kids, insertAfter is ignored.

PDSElementInsertMCAsKidEx

Header: PDSWriteProcs.h:798

Description

Extends PDSElementInsertMCAsKid(), inserting content that is in a stream other than a page content stream. This function is the same as PDSElementInsertStmMCAsKid().

This may raise various exceptions.

Syntax

void PDSElementInsertMCAsKidEx(IN PDSElement element, IN CosObj cosPage, IN PDSMC mc, IN ASInt32 insertAfter, IN CosObj cosStream, IN CosObj streamOwner);

Parameters

element
The element in which the reference is inserted.
cosPage
The CosObj for the page containing the reference to insert.
mc
The marked content to insert.
insertAfter
The position after which the reference is inserted. If element currently has no kids, insertAfter is ignored.
cosStream
The stream containing the content given by mc.
streamOwner
A Cos object to record as the owner of the content. It can be CosNull if the owner is not important.

PDSElementInsertMCRefAsKid

Header: PDSWriteProcs.h:910

Description

Takes a marked content reference and places the content that it identifies in the structure as a child of the element.

This may raise various exceptions.

Note: the content reference handle will be filled out automatically if PDPageSetPDEContent(), PDEFormSetContent(), or PDEGroupSetContent() is called. Otherwise, PDEContentSetPage() or PDEContentSetContainingStmAndOwner() must be called explicitly.

Related Methods

Syntax

ASBool PDSElementInsertMCRefAsKid(IN PDSElement element, IN PDSMCRef ref, IN ASInt32 insertAfter);

Parameters

element
The structure element with which to associate marked content.
ref
The marked content reference describing the content on the page. It must have had a valid MCID, and must have been completed by subsequent content stream processing calls.
insertAfter
The position after which the marked content is inserted into the element's kids. If the element has no children, insertAfter is ignored.

PDSElementInsertOBJAsKid

Header: PDSWriteProcs.h:432

Description

Inserts a reference to the specified PDF object as a kid into the specified element.

This may raise various exceptions.

Related Methods

Syntax

void PDSElementInsertOBJAsKid(IN PDSElement element, IN CosObj cosPage, IN CosObj obj, IN ASInt32 insertAfter);

Parameters

element
IN/OUT The element in which the reference is inserted.
cosPage
IN/OUT The CosObj for the page containing the reference to insert.
obj
IN/OUT The CosObj to insert.
insertAfter
IN/OUT The position after which the reference is inserted in element. If element currently has no kids, insertAfter is ignored.

PDSElementInsertStmMCAsKid

Header: PDSWriteProcs.h:828

Description

Inserts a marked content sequence from a non-page-content stream as a kid of the specified element.

This may raise various exceptions.

Syntax

void PDSElementInsertStmMCAsKid(PDSElement element, CosObj cosPage, CosObj containingStm, CosObj stmOwner, PDSMC mc, ASInt32 insertAfter);

Parameters

element
The element in which the reference is inserted.
cosPage
The CosObj for the page containing the reference to insert.
containingStm
The stream containing the content given by mc.
stmOwner
The PDF object owning the stream given in cosStream (for example, the annotation to which an appearance stream belongs). It can be CosNull if the owner is not important.
mc
The marked content to insert.
insertAfter
The position after which the reference is inserted. If element currently has no kids, insertAfter is ignored.

PDSElementRemoveAllAttrObjs

Header: PDSWriteProcs.h:293

Description

Removes all attribute objects directly associated with the specified element.

Related Methods

Syntax

void PDSElementRemoveAllAttrObjs(IN PDSElement element);

Parameters

element
The element whose attributes are removed.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementRemoveAllClasses

Header: PDSWriteProcs.h:349

Description

Removes all classes from the specified element.

Syntax

void PDSElementRemoveAllClasses(IN PDSElement element);

Parameters

element
IN/OUT The element whose classes are removed.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementRemoveAttrObj

Header: PDSWriteProcs.h:282

Description

Removes the specified attribute object from an element. If element does not have an attrObj attribute, this method does nothing.

Note: Calling PDSElementRemoveAttrObj() while iterating over the attribute objects of an element will change the relationship between the attribute object indices and attribute objects. Although it is possible to track this change in indices in a single loop, it is more straightforward to accumulate a list of attribute objects to remove during one pass over the attribute objects and to carry out the actual removals during a subsequent iteration over the accumulated list.

Syntax

void PDSElementRemoveAttrObj(IN PDSElement element, IN PDSAttrObj attrObj);

Parameters

element
The element whose attribute is removed.
attrObj
The attribute object to remove.

Exceptions

is raised if element is not a valid PDSElement or attrObj is not a valid attribute object.

PDSElementRemoveClass

Header: PDSWriteProcs.h:336

Description

Removes the specified class name from the element's list of classes to which it belongs.

Note: Calling PDSElementRemoveClass() while iterating over the classes of an element will change the relationship between class indices and classes. Although it is possible to track this change in indices in a single loop, it is more straightforward to accumulate a list of classes to remove during one pass over the classes and to carry out the actual removals during a subsequent iteration over the accumulated list.

Syntax

void PDSElementRemoveClass(IN PDSElement element, IN ASAtom classAtom);

Parameters

element
The element from which the specified class is removed.
classAtom
The ASAtom representing the class to remove.

Exceptions

is raised if element is not a valid PDSElement.

PDSElementRemoveKid

Header: PDSWriteProcs.h:450

Description

Removes the specified kid from an element.

This may raise various exceptions.

Note: The approved method of removing OBJ kids is PDSElementRemoveKidOBJ().

Syntax

void PDSElementRemoveKid(IN PDSElement element, IN CosObj kid);

Parameters

element
The element whose kid is removed.
kid
The kid to remove.

PDSElementRemoveKidMC

Header: PDSWriteProcs.h:470

Description

Removes the specified PDSMC (marked content) from an element's kids, if it has any.

After calling this method, use PDPageSetPDEContent() to commit any changes that have been made to the page contents.

This may raise various exceptions.

Syntax

void PDSElementRemoveKidMC(IN PDSElement element, IN CosObj cosPage, IN PDSMC mc);

Parameters

element
The element whose reference is removed.
cosPage
The CosObj for the page containing the reference to remove.
mc
The marked content to remove.

PDSElementRemoveKidOBJ

Header: PDSWriteProcs.h:770

Description

Removes an OBJ from among the kids of a given element. It does nothing if the given OBJ is not a kid of the given element.

This may raise various exceptions.

Syntax

void PDSElementRemoveKidOBJ(IN PDSElement element, IN CosObj kid);

Parameters

element
The element whose kid is having an OBJ removed.
kid
The kid whose OBJ is removed.

PDSElementReplaceKid

Header: PDSWriteProcs.h:490

Description

Replaces the specified kid in the specified element.

This may raise various exceptions.

Note: The approved method of replacing OBJ kids is PDSElementReplaceKidOBJ().

Syntax

void PDSElementReplaceKid(IN PDSElement element, IN CosObj oldKid, IN CosObj newKid);

Parameters

element
IN/OUT The element whose kid is replaced.
oldKid
IN/OUT The kid to replace.
newKid
IN/OUT The kid that is replacing oldKid.

PDSElementReplaceKidMC

Header: PDSWriteProcs.h:510

Description

Replaces the specified PDSMC (on oldCosPage) with a new PDSMC (on newCosPage) in the specified element.

This may raise various exceptions.

Syntax

void PDSElementReplaceKidMC(IN PDSElement element, IN CosObj oldCosPage, IN PDSMC oldMC, IN CosObj newCosPage, IN PDSMC newMC);

Parameters

element
The element whose reference is replaced.
oldCosPage
The CosObj for the page holding the reference to replace.
oldMC
The marked content to replace.
newCosPage
The CosObj for the page holding the reference that is replacing oldMC.
newMC
The marked content that is replacing oldMC.

PDSElementReplaceKidOBJ

Header: PDSWriteProcs.h:529

Description

Replaces oldObj with newObj on the specified page in the specified element.

This may raise various exceptions.

Syntax

void PDSElementReplaceKidOBJ(IN PDSElement element, IN CosObj oldObj, IN CosObj newObj, IN CosObj newPage);

Parameters

element
IN/OUT The element whose object is replaced.
oldObj
IN/OUT The object to replace.
newObj
IN/OUT The object that is replacing oldObj.
newPage
IN/OUT The CosObj for the page holding the reference that is replacing oldObj.

PDSElementSetActualText

Header: PDSWriteProcs.h:732

Description

Sets the actual text representation of the specified PDSElement object's contents to buffer (from 0 to nBytes).

Related Methods

Syntax

void PDSElementSetActualText(IN PDSElement element, IN const ASUns8 *buffer, IN ASInt32 nBytes);

Parameters

element
The PDSElement whose contents are being set to buffer.
buffer
The buffer to which the PDSElement object's contents are being set.
nBytes
The number of bytes in the text representation.

PDSElementSetActualTextASText

Header: PDSWriteProcs.h:940

Description

Sets an element's actual text.

Syntax

void PDSElementSetActualTextASText(PDSElement element, const ASText text);

Parameters

element
The element whose content is being set.
text
The text object containing the string to be made the element's actual text.

PDSElementSetAlt

Header: PDSWriteProcs.h:369

Description

Sets the alternate text representation of an element's contents.

Syntax

void PDSElementSetAlt(IN PDSElement element, IN const ASUns8 *buffer, IN ASInt32 nBytes);

Parameters

element
IN/OUT The element whose alternate text representation is set.
buffer
IN/OUT A pointer to a buffer containing a string to be made the element's alternate text representation.
nBytes
IN/OUT The number of bytes in buffer to use as the element parameter's new alternate text representation. It may be zero. It sets an Alt string even if the buffer length is zero, but such an Alt string looks like no Alt string according to PDSElementGetAlt().

Exceptions

is raised if element is not a valid PDSElement.

PDSElementSetAltASText

Header: PDSWriteProcs.h:956

Description

Sets the alternate text representation of an element's contents (ASText version of PDSElementSetAlt).

Syntax

void PDSElementSetAltASText(PDSElement element, const ASText text);

Parameters

element
The element whose alternate text representation is being set.
text
The text object containing the string to be set as the element's alternate text representation.

Exceptions

Raises
pdsErrWrongTypeParameter if element is not a valid PDSElement.

PDSElementSetID

Header: PDSWriteProcs.h:547

Description

Sets the ID of an element to the given Cos string.

Syntax

void PDSElementSetID(IN PDSElement element, IN const ASUns8 *buffer, IN ASInt32 nBytes);

Parameters

element
The element whose ID is set.
buffer
A pointer to a buffer containing a string to be made the element's ID.
nBytes
The number of bytes in buffer to use as the element parameter's new ID. It may be zero. It sets an ID even if the buffer length is zero, but such an ID looks like no ID according to PDSElementGetID().

Exceptions

is raised if another element already has the ID as its ID.
is raised if element is not a valid PDSElement.

PDSElementSetLanguage

Header: PDSWriteProcs.h:754

Description

Sets the language field associated with the PDSElement to the buffer parameter's contents (from 0 to nBytes).

Note: IANA registered language codes can be found at http://www.isi.edu.

Note: The IETF Standard for Language Element Values (RFC 1766) can be found at http://www.ietf.org/rfc/rfc1766.txt?number=1766.

Syntax

void PDSElementSetLanguage(IN PDSElement element, IN const ASUns8 *buffer, IN ASInt32 nBytes);

Parameters

element
The PDSElement whose language field is set to buffer.
buffer
A pointer to a buffer containing a string to be made the element's language field. The empty string indicates that the language is unknown. The string should be in the format IETF RFC-1766-language-code>. Note that the ISO 639 language codes can be found at http://lcweb.loc.gov/standards/iso639-2.
nBytes
The size of buffer. It may be zero. It sets the language even if the buffer length is zero, but such a language setting looks like no language according to PDSElementGetLanguage.

PDSElementSetTitle

Header: PDSWriteProcs.h:233

Description

Sets an element's title.

Related Methods

Syntax

void PDSElementSetTitle(IN PDSElement element, IN const ASUns8 *buffer, IN ASInt32 nBytes);

Parameters

element
IN/OUT The element whose title is set.
buffer
IN/OUT A pointer to a buffer containing a string to be made the element's title.
nBytes
IN/OUT The number of bytes in buffer to use as the element parameter's new title. It may be zero. It sets a title even if the buffer length is zero, but such a title looks like no title according to PDSElementGetTitle().

Exceptions

is raised if element is not a valid PDSElement.

PDSElementSetTitleASText

Header: PDSWriteProcs.h:926

Description

Sets an element's title.

Syntax

void PDSElementSetTitleASText(PDSElement element, const ASText title);

Parameters

element
The element whose title is being set.
title
The text object containing the string to be made the element's title.

Exceptions

Raises
pdsErrWrongTypeParameter if element is not a valid PDSElement.

PDSElementSetType

Header: PDSWriteProcs.h:218

Description

Sets an element's type value to the specified type. The type corresponds to the Subtype key in the structure element dictionary.

PDSElementSetType() sets the value of the Subtype key, not the Type key, in the structure element dictionary. All PDSElement objects have a Type value of StructElem.

Related Methods

Syntax

void PDSElementSetType(IN PDSElement element, IN ASAtom type);

Parameters

element
The element whose type is set.
type
The ASAtom representing the element's type.

Exceptions

is raised if element is not a valid PDSElement.

PDSOBJGetParent

Header: PDSReadProcs.h:520

Description

Gets the parent element of the specified PDF object.

This may throw various exceptions.

Related Methods

Syntax

void PDSOBJGetParent(IN CosObj obj, OUT PDSElement *parent);

Parameters

obj
IN/OUT The PDF object whose parent element is obtained. It must be referred to via an OBJR from some element (that is, it has a struct parent key), otherwise it is undefined.
parent
IN/OUT (Filled by the method) The parent element of obj.