DynaPDF Manual - Page 114

Previous Page 113   Index   Next Page 115

Function Reference
Page 114 of 770
// we create a few dummy pages to test the bookmarks
char s[30];
for (i = 0; i < 7; i++)
{
pdfAppend(pdf);
pdfChangeFont(pdf, f); // set the font with same parameters
sprintf(s, "Page %d", i+2);
pdfWriteFText(pdf, taLeft, s);
pdfEndPage(pdf);
}
// The first item is always a root node, Parent must be -1.
SI32 bmk = pdfAddBookmark(pdf, "First root node", -1, 1, true);
pdfAddBookmark(pdf, "1. sub node", bmk, 2, false);
pdfAddBookmark(pdf, "2. sub node", bmk, 3, false);
pdfAddBookmark(pdf, "3. sub node", bmk, 4, false);
bmk = pdfAddBookmark(pdf, "Closed sub node", bmk, 5, false);
pdfAddBookmark(pdf, "1. sub node", bmk, 6, false);
pdfAddBookmark(pdf, "2. sub node", bmk, 7, false);
bmk = pdfAddBookmark(pdf, "Closed root node", -1, 1, false);
pdfAddBookmark(pdf, "1. sub node", bmk, 4, false);
pdfAddBookmark(pdf, "2. sub node", bmk, 8, false);
pdfCloseFile(pdf);
return 0;
}
Output:
 

Previous topic: AddArticle, AddBookmark

Next topic: AddBookmarkEx