PDFOUTLINES_AddFirst
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_AddFirst (
LONG nodeIndex,
BSTR nodeTitle,
LONG actionIndex,
TxFontCharset charset
)
Parameters
nodeIndex
Index of any sibling 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 first sibling of the node specified by the nodeIndex parameter. Use PDFOUTLINES_Add to add node as the last 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 a 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

AddFirst Example

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
lAction := PDF.CreateGoToPageAction(0, 0);
o1 := PDF.PDFOUTLINES_AddFirst(0, 'Last', lAction, charsetANSI_CHARSET);
o2 := PDF.PDFOUTLINES_AddFirst(0, 'Third', lAction, charsetANSI_CHARSET);
o3 := PDF.PDFOUTLINES_AddFirst(0, 'Second', lAction, charsetANSI_CHARSET);
o4 := PDF.PDFOUTLINES_AddFirst(0, 'First', lAction, charsetANSI_CHARSET);
PDF.EndDoc;

{ Outlines will look like: }
{  First                   }
{  Second                  }
{  Third                   }
{  Last                    }
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
LONG lAction = PDF->CreateGoToPageAction(0, 0);
LONG o1 = PDF->PDFOUTLINES_AddFirst(0, "Last", lAction, charsetANSI_CHARSET);
LONG o2 = PDF->PDFOUTLINES_AddFirst(0, "Third", lAction, charsetANSI_CHARSET);
LONG o3 = PDF->PDFOUTLINES_AddFirst(0, "Second", lAction, charsetANSI_CHARSET);
LONG o4 = PDF->PDFOUTLINES_AddFirst(0, "First", lAction, charsetANSI_CHARSET);
PDF->EndDoc();

// Outlines will look like:
//  First
//  Second
//  Third
//  Last
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
long lAction = PDF.CreateGoToPageAction(0, 0);
long o1 = PDF.PDFOUTLINES_AddFirst(0, "Last", lAction, TxFontCharset.charsetANSI_CHARSET);
long o2 = PDF.PDFOUTLINES_AddFirst(0, "Third", lAction, TxFontCharset.charsetANSI_CHARSET);
long o3 = PDF.PDFOUTLINES_AddFirst(0, "Second", lAction, TxFontCharset.charsetANSI_CHARSET);
long o4 = PDF.PDFOUTLINES_AddFirst(0, "First", lAction, TxFontCharset.charsetANSI_CHARSET);
PDF.EndDoc();

// Outlines will look like:
//  First
//  Second
//  Third
//  Last
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
lAction = PDF.CreateGoToPageAction(0, 0)
o1 = PDF.PDFOUTLINES_AddFirst(0, "Last", lAction, 0)
o2 = PDF.PDFOUTLINES_AddFirst(0, "Third", lAction, 0)
o3 = PDF.PDFOUTLINES_AddFirst(0, "Second", lAction, 0)
o4 = PDF.PDFOUTLINES_AddFirst(0, "First", lAction, 0)
PDF.EndDoc

' Outlines will look like:
'  First
'  Second
'  Third
'  Last

See Also

Reference