PDFOUTLINES_Add
IPDFDocument3 :: Outlines

See Also Example
Collapse All

This method adds a new tree node to a tree of the outline items.

Syntax

LONG PDFOUTLINES_Add (
LONG nodeIndex,
BSTR nodeTitle,
LONG actionIndex,
TxFontCharset charset
)
Parameters
nodeIndex
Index of any sibling node

nodeTitle
Title of the new node

actionIndex
Action index of the new node

charset
Character set (code page) of the new node

Return value
Index of the new node

Remarks

This method adds a new node to a tree as the last sibling of the node specified by the nodeIndex parameter. Use PDFOUTLINES_AddFirst to add node as the first sibling of the node specified by the nodeIndex parameter. Use PDFOUTLINES_Insert to insert a node in the specified position.

This method returns the node that has been added.An action (with an index specified by actionIndex) executes when a user clicks the created node. The created node contains a nodeTitle as the node's own 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::AddOutlineAfter, IPDFDocument4::AddOutlineBefore, IPDFDocument4::AddUnicodeOutlineAfter, IPDFDocument4::AddUnicodeOutlineBefore.

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