Get the number of children of an outline node.
int pdfGetOutlineNumChildren(PDFViewerHandle viewer, PDFOutlineHandle outline)
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 the PDFOutlineHandle type 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 NULL 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 NULL as the outline argument to specify the root node, i.e., to get the number of top-level outline entries.

/* start out at the root node */ scanOutline(NULL); ... void scanOutline(PDFOutlineHandle outline) { int n, i; if (outline) { /* do something with this outline entry */ } else { /* this is the root node, which isn't a real entry - * it has no title or target */ } /* now scan the children of this node (if any) */ n = pdfGetOutlineNumChildren(viewer, outline); for (i = 0; i < n; ++i) { scanOutline(pdfGetOutlineChild(viewer, outline, i)); } }