cete.dynamicpdf.pageelements.bookmark
Bookmark
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a bookmark.
public class Bookmark : PageElement, ICoordinate, ISerializable
Public Class Bookmark
Inherits PageElement
Implements ICoordinate, ISerializable
Inheritance: Object → PageElement → Bookmark
Implements: ICoordinate, ISerializable
Licensing
This class is a DynamicPDF Generator Professional Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Professional Edition
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Professional Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Professional Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Professional Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
Examples
The following example will place three bookmarks on the PDF document. Each bookmark has a different action.
The first bookmark links to a URL and when clicked on will open up that URL in the current window. The second bookmark when
clicked will zoom the page to fit the width of that page. The third bookmark when clicked will bring the specified X, Y
destination into focus. If that destination location is already visible no action is taken.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule Sub Main() ' 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:\MyDocument.pdf") End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
class MyClass
{static void Main(){ // 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:\MyDocument.pdf" );}
}
Remarks
This class can be used to place bookmarks on the PDF document. These bookmarks will be displayed to the right of the PDF document. See the Outlines and Bookmarks topic for more details on bookmarks.
NOTE: This page element cannot be used within a table cell, or tranformation group.
Constructors
Bookmark(String, Single, Single)
Initializes a new instance of the Bookmark class.
public Bookmark(string text, float x, float y)
Public Sub New (text As String, x As Single, y As Single)
Parameters
- text: String
Text of the bookmark.
- x: Single
X coordinate of the bookmark.
- y: Single
Y coordinate of the bookmark.
Bookmark(String, Single, Single, Outline)
Initializes a new instance of the Bookmark class.
public Bookmark(string text, float x, float y, Outline parentOutline)
Public Sub New (text As String, x As Single, y As Single, parentOutline As Outline)
Parameters
- text: String
Text of the bookmark.
- x: Single
X coordinate of the bookmark.
- y: Single
Y coordinate of the bookmark.
- parentOutline: Outline
Outline object that the bookmark will appear under.
Properties
Color
Gets or sets the Color object to use for the text of the bookmark.
public RgbColor Color { get; set; }
Public Property Color As RgbColor
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
ParentOutline
Gets or sets the Outline object the bookmark will appear under.
public Outline ParentOutline { get; set; }
Public Property ParentOutline As Outline
Property Value
Style
Gets or sets the TextStyle enumeration that represents the text style of the bookmark.
public TextStyle Style { get; set; }
Public Property Style As TextStyle
Property Value
Text
Gets or sets the text of the bookmark.
public string Text { get; set; }
Public Property Text As String
Property Value
X
Gets of sets the X coordinate of the bookmark.
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or sets the Y coordinate of the bookmark.
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the bookmark to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the bookmark's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .