cete.dynamicpdf.pageelements.bookmark
Bookmark
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: DynamicPDF.CoreSuite.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 Info
This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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;
public class Example
{
public static void CreatePDF(string outputPath)
{
// 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(outputPath);
}
}
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 transformation 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.
Licensing Info
This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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.
Licensing Info
This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
IgnoreMargins
Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement)
public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will place the Label in the top-left of the page with IgnoreMargin
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
ParentOutline
Gets or sets the Outline object the bookmark will appear under.
public Outline ParentOutline { get; set; }
Public Property ParentOutline As Outline
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
RelativeTo
Gets and sets placement of the page element on the page. (Inherited from PageElement)
public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will place the Label in the top-left of the page.
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
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
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Text
Gets or sets the text of the bookmark.
public string Text { get; set; }
Public Property Text As String
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
X
Gets of sets the X coordinate of the bookmark.
public float X { get; set; }
Public Property X As Single
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Y
Gets or sets the Y coordinate of the bookmark.
public float Y { get; set; }
Public Property Y As Single
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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 .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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 .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.