getOutlineNumChildren
Get the number of children of an outline node.
getOutlineNumChildren([in] LONG outlineHandle, [out, retval] int *n)
A PDF file may contain an outline: a list of bookmarks pointing to
chapters, sections, etc. The outline is structured as a tree. For
example, the top layer might be a list of chapters, where each chapter
contains a list of sections, etc. XpdfViewer uses an opaque handle to
represent a node in this tree, i.e., an outline entry. Each node has a
title (the string describing the outline entry), a target (location in
the document), and possibly a list of child nodes. As a special case,
the zero handle indicates the root node, which has a list of children
(assuming the PDF file has an outline at all) but no title or target.
This function returns the number of child nodes contained in a specified node. It returns zero if the node has no children.
Pass zero as the outline
argument to specify the root
node, i.e., to get the number of top-level outline entries.
VB:
' start out at the root node
scanOutline(0)
...
Private Sub scanOutline(outlineHdl As Long) {
If outlineHdl <> 0 Then
' do something with this outline entry
Else
' this is the root node, which isn't a real entry - it has no title or target
End If
' now scan the children of this node (if any)
n = viewer.getOutlineNumChildren(outlineHdl)
For i = 0 To n-1
scanOutline(viewer.getOutlineChild(outlineHdl, i))
Next i
End Sub