DynaPDF Manual - Page 468

Previous Page 467   Index   Next Page 469

Function Reference
Page 468 of 839
GetOCUINode
Syntax:
IOCN* pdfGetOCUINode(
const PPDF* IPDF,
// Instance pointer
const IOCN* Node,
// Node pointer or NULL to get the root
struct TPDFOCUINode* OutNode) // See below
struct TPDFOCUINode
{
UI32 StructSize;
// Must be set to sizeof(TOCUINode)
const char* LabelA; // Optional label.
const UI16* LabelW; // Either the Ansi or Unicode string is set at time but never both.
UI32 LabelLength;
// Length in characters without the null-terminator.
IOCN* NextChild;
// If set, the next child node that must be loaded.
LBOOL NewNode;
// If true, a new child node must be created.
SI32 OCG;
// Optional OCG handle. -1 if not set -> GetOCG().
};
The function retrieves the most important properties of an Optional Content UI node (UI stands for
User Interface).
Notice:
If the PDF file was not already imported with ImportPDFFile() the function
ImportOCProperties() must be called to import the global Optional Content Properties.
UI nodes are part of a layer configuration. Therefore, a layer configuration must be loaded with
LoadLayerConfig() before the function can be called.
Optional Content Groups (OCGs) which are returned by this function should be visible in the user
interface of a viewer application. All other OCGs should not be shown by default.
UI nodes are stored in a single linked list. To get the pointer of the root node set the parameter Node
to NULL. The parameter OutNode will be ignored in this case but it is required otherwise.
The next node of the root is the return value of this function. If no further node is available the
return value will be NULL.
Every node can contain one or more child nodes, an optional label, or a reference to an OCG.
To achieve the same nesting as in Adobe's Acrobat or Reader the nodes must be added to a custom
tree control as shown in the following simplified algorithm (Delphi):
function GetString(const ValueA: PAnsiChar; const ValueW: PWideChar): String;
begin
// Make never a direct typecast from PAnsiChar to String because this causes a buffer overrun!
if ValueA <> nil then
Result := String(AnsiString(ValueA))
else
Result := String(WideString(ValueW));
end;
 

Previous topic: GetOCGCount, GetOCGUsageUserName, GetOCHandle

Next topic: GetOpacity, GetOrientation, GetOutputIntent