PDFOUTLINES_AddChild
IPDFDocument3 :: Outlines

See Also Example
Collapse All

This nethod adds a new tree node as the first sibling to a tree of the outline items.

Syntax

LONG PDFOUTLINES_AddChild (
LONG parentNodeIndex,
BSTR nodeTitle,
LONG actionIndex,
TxFontCharset charset
)
Parameters
parentNodeIndex
Index of a new node's parent node

nodeTitle
Title of a new node

actionIndex
Action index of a new node

charset
Character set (code page) of a new node

Return value
Index of the new node

Remarks

This method adds a new node to a tree as the child of the node specified by the parentNodeIndex parameter. It returns the node that has been added. An action (with an action index specified by actionIndex) executes when a user clicks the created node. The created node is added to the end of the node's list of child nodes and contains a nodeTitle paramter as text in a charset code page.

The return value is an outline identifier in document's outlines collection and can be used in SetCurrentPDFOutlineNode, PDFOUTLINES_Add, PDFOUTLINES_AddChild, PDFOUTLINES_AddFirst, PDFOUTLINES_Insert.

Equivalent in new interface: IPDFDocument4::AddOutlineChild, IPDFDocument4::AddUnicodeOutlineChild.

Example

PDF Outline Construction Sample

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
lAction := PDF.CreateGoToPageAction(0, 0);
i0 := PDF.PDFOUTLINES_Add(0, '0', lAction, charsetANSI_CHARSET);
i1 := PDF.PDFOUTLINES_Add(i0, '1', lAction, charsetANSI_CHARSET);
{ you may set 1st parameter to any sibling }
i2 := PDF.PDFOUTLINES_Add(i1, '2', lAction, charsetANSI_CHARSET);
' it is identical to
' i2 := PDF.PDFOUTLINES_Add(i0, '2', lAction, charsetANSI_CHARSET);
i3 := PDF.PDFOUTLINES_AddChild(i0, '3', lAction, charsetANSI_CHARSET);
PDF.EndDoc;

{ This code will produce a tree with nodes arranged like this:
 0
  3
 1
 2
}
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
LONG lAction = PDF.CreateGoToPageAction (0, 0);
LONG i0 = PDF->PDFOUTLINES_Add(0, "0", lAction, charsetANSI_CHARSET);
LONG i1 = PDF->PDFOUTLINES_Add(i0, "1", lAction, charsetANSI_CHARSET);
// you may set 1st parameter to any sibling
LONG i2 = PDF->PDFOUTLINES_Add(i1, "2", lAction, charsetANSI_CHARSET);
// it is identical to
// LONG i2 = PDF->PDFOUTLINES_Add(i0, "2", lAction, charsetANSI_CHARSET);
LONG i3 = PDF->PDFOUTLINES_AddChild(i0, "3", lAction, charsetANSI_CHARSET);
PDF->EndDoc();

/* This code will produce a tree with nodes arranged like this:
 0
  3
 1
 2
*/
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
long lAction = PDF.CreateGoToPageAction (0, 0);
long i0 = PDF.PDFOUTLINES_Add(0, "0", lAction, TxFontCharset.charsetANSI_CHARSET);
long i1 = PDF.PDFOUTLINES_Add(i0, "1", lAction, TxFontCharset.charsetANSI_CHARSET);
// you may set 1st parameter to any sibling
long i2 = PDF.PDFOUTLINES_Add(i1, "2", lAction, TxFontCharset.charsetANSI_CHARSET);
// it is identical to
// long i2 = PDF.PDFOUTLINES_Add(i0, "2", lAction, TxFontCharset.charsetANSI_CHARSET);
long i3 = PDF.PDFOUTLINES_AddChild(i0, "3", lAction, TxFontCharset.charsetANSI_CHARSET);
PDF.EndDoc();

/* This code will produce a tree with nodes arranged like this:
 0
  3
 1
 2
*/
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
lAction = PDF.CreateGoToPageAction (0, 0)
i0 = PDF.PDFOUTLINES_Add(0, "0", lAction, 0)
i1 = PDF.PDFOUTLINES_Add(i0, "1", lAction, 0)
' you may set 1st parameter to any sibling
i2 = PDF.PDFOUTLINES_Add(i1, "2", lAction, 0)
' it is identical to
' i2 = PDF.PDFOUTLINES_Add(i0, "2", lAction, 0)
i3 = PDF.PDFOUTLINES_AddChild(i0, "3", lAction, 0)
PDF.EndDoc

' This code will produce a tree with nodes arranged like this:
' 0
'  3
' 1
' 2

See Also

Reference