Skip to content

Instantly share code, notes, and snippets.

@cjlotz
Created April 2, 2013 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjlotz/5295274 to your computer and use it in GitHub Desktop.
Save cjlotz/5295274 to your computer and use it in GitHub Desktop.
private void CreateBookmarks()
{
PdfContentByte content = _writer.DirectContent;
PdfOutline outline = content.RootOutline;
foreach (var bookmark in Bookmarks)
{
if (bookmark.IsReleaseHeader)
outline = CreatePdfOutline(content.RootOutline, bookmark);
else
CreatePdfOutline(outline, bookmark);
}
}
private PdfOutline CreatePdfOutline(PdfOutline parent, Bookmark bookmark)
{
return new PdfOutline(parent, PdfAction.GotoLocalPage(bookmark.PageNumber, new PdfDestination(bookmark.PageNumber), _writer), bookmark.Title);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment