Outlines can be included in the PDF document to allow quick access to specific pages in the PDF document. These can be added to the document in one of two ways.
Outlines
Outlines can be added to the document through the Outlines property of the Document object. The Document contains a hierarchical list of outlines to associate with the Document. These outlines have properties for controlling the color and style as well as a property to control if it is expanded by default:
[Visual Basic] ' Create a PDF Document Dim MyDocument As Document = New Document() ' Add three blank pages MyDocument.Pages.Add( New Page( PageSize.Letter ) ) MyDocument.Pages.Add( New Page( PageSize.Letter ) ) MyDocument.Pages.Add( New Page( PageSize.Letter ) ) ' Add a top level outline and set properties Dim MyOutline1 As Outline = MyDocument.Outlines.Add( "Outline1" ) MyOutline1.Style = TextStyle.Bold MyOutline1.Color = New RGBColor( 255, 0, 0 ) ' Add child outlines Dim MyOutline1A As Outline = MyOutline1.Outlines.Add( "Outline1A", New ZoomDestination( 2, PageZoom.FitPage ) ) MyOutline1A.IsExpanded = False Dim MyOutline1A1 As Outline = MyOutline1A.Outlines.Add( "Outline1A1", New XYDestination( 2, 0, 0 ) ) Dim MyOutline1A2 As Outline = MyOutline1A.Outlines.Add( "Outline1A2", New ZoomDestination( 2, PageZoom.FitHeight ) ) Dim MyOutline1B As Outline = MyOutline1.Outlines.Add( "Outline1B", New ZoomDestination( 2, PageZoom.FitWidth ) ) ' Add a second top level outline Dim MyOutline2 As Outline = MyDocument.Outlines.Add( "Outline2", New XYDestination( 3, 0, 300 ) ) ' Add a child outline Dim MyOutline2A As Outline = MyOutline2.Outlines.Add( "Outline2A" ) ' Save the PDF document MyDocument.Draw( "C:\MyOutlines.pdf" ) [C#] // Create a PDF Document Document document = new Document(); // Add three blank pages document.Pages.Add( new Page( PageSize.Letter ) ); document.Pages.Add( new Page( PageSize.Letter ) ); document.Pages.Add( new Page( PageSize.Letter ) ); // Add a top level outline and set properties Outline outline1 = document.Outlines.Add( "Outline1" ); outline1.Style = TextStyle.Bold; outline1.Color = new RGBColor( 255, 0, 0 ); // Add child outlines Outline outline1A = outline1.Outlines.Add( "Outline1A", new ZoomDestination( 2, PageZoom.FitPage ) ); outline1A.IsExpanded = false; Outline outline1A1 = outline1A.Outlines.Add( "Outline1A1", new XYDestination( 2, 0, 0 ) ); Outline outline1A2 = outline1A.Outlines.Add( "Outline1A2", new ZoomDestination( 2, PageZoom.FitHeight ) ); Outline outline1B = outline1.Outlines.Add( "Outline1B", new ZoomDestination( 2, PageZoom.FitWidth ) ); // Add a second top level outline Outline outline2 = document.Outlines.Add( "Outline2", new XYDestination( 3, 0, 300 ) ); // Add a child outline Outline outline2A = outline2.Outlines.Add( "Outline2A" ); // Save the PDF document document.Draw( @"C:\MyOutlines.pdf" );The location that the outline links to can be specified using Action objects. There are three Action objects included with Generator for .NET:
- UrlAction - Links to an external URL.
- XYDestination - Links to an XY coordinate on a page.
- ZoomDestination - Links to a page at a specified zoom level.
Bookmarks
Outlines can also be added to the document using the Bookmark Page Element. This object can be used to add outlines to the root of the document or to add outlines beneath a parent outline. These bookmarks always link to a coordinate on the page that contains them:
[Visual Basic] ' Create a PDF Document Dim MyDocument As Document = New Document() ' Create three page objects Dim MyPage1 As Page = New Page( PageSize.Letter ) Dim MyPage2 As Page = New Page( PageSize.Letter ) Dim MyPage3 As Page = New Page( PageSize.Letter ) ' Add a top level Outline Dim MyParentOutline As Outline = MyDocument.Outlines.Add( "Parent Outline" ) ' Add a top level bookmark MyPage1.Elements.Add( New Bookmark( "Top level bookmark to page 1", 0, 0 ) ) ' Add child bookmarks MyPage1.Elements.Add( New Bookmark( "Bookmark to page 1", 0, 0, MyParentOutline ) ) MyPage2.Elements.Add( New Bookmark( "Bookmark to page 2", 0, 0, MyParentOutline ) ) MyPage3.Elements.Add( New Bookmark( "Bookmark to page 3", 0, 0, MyParentOutline ) ) ' Add the three pages to the document MyDocument.Pages.Add( MyPage1 ) MyDocument.Pages.Add( MyPage2 ) MyDocument.Pages.Add( MyPage3 ) ' Save the PDF document MyDocument.Draw( "C:\MyOutlines.pdf" ) [C#] // Create a PDF Document Document document = new Document(); // Create three page objects Page page1 = new Page( PageSize.Letter ); Page page2 = new Page( PageSize.Letter ); Page page3 = new Page( PageSize.Letter ); // Add a top level Outline Outline parentOutline = document.Outlines.Add( "Parent Outline" ); // Add a top level bookmark page1.Elements.Add( new Bookmark( "Top level bookmark to page 1", 0, 0 ) ); // Add child bookmarks page1.Elements.Add( new Bookmark( "Bookmark to page 1", 0, 0, parentOutline ) ); page2.Elements.Add( new Bookmark( "Bookmark to page 2", 0, 0, parentOutline ) ); page3.Elements.Add( new Bookmark( "Bookmark to page 3", 0, 0, parentOutline ) ); // Add the three pages to the document document.Pages.Add( page1 ); document.Pages.Add( page2 ); document.Pages.Add( page3 ); // Save the PDF document document.Draw( @"C:\MyOutlines.pdf" );

