Class PdfBookmark
- Namespace
- Syncfusion.Pdf.Interactive
- Assembly
- Syncfusion.Pdf.Portable.dll
Each instance of this class represents an bookmark node in the bookmark tree.
public class PdfBookmark : PdfBookmarkBase, IEnumerable
- Inheritance
-
PdfBookmark
- Implements
- Derived
- Inherited Members
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = document.Bookmarks.Add("Page 1");
//Set the destination page.
bookmark.Destination = new PdfDestination(page);
//Set the destination location.
bookmark.Destination.Location = new PointF(20, 20);
//Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold;
bookmark.Color = Color.Red;
//Save and close the PDF document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = document.Bookmarks.Add("Page 1")
'Set the destination page.
bookmark.Destination = New PdfDestination(page)
'Set the destination location.
bookmark.Destination.Location = New PointF(20, 20)
'Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold
bookmark.Color = Color.Red
'Save and close the PDF document.
document.Save("Output.pdf")
document.Close(True)
Properties
Action
Gets or sets the action for the outline.
public PdfAction Action { get; set; }
Property Value
Examples
//Create a new document.
PdfDocument Document = new PdfDocument();
//Add a page.
PdfPage page = Document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = Document.Bookmarks.Add("page1");
//Set color.
bookmark.Color = Color.Red;
//Create a Uri action
PdfUriAction uriAction = new PdfUriAction("http://www.google.com");
//Set the Uri action
bookmark.Action = uriAction;
//Save and close the PDF document.
Document.Save("Output.pdf");
Document.Close(true);
'Create a new document.
Dim Document As New PdfDocument()
'Add a page.
Dim page As PdfPage = Document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = Document.Bookmarks.Add("page1")
'Set color.
bookmark.Color = Color.Red
'Create a Uri action
Dim uriAction As New PdfUriAction("http://www.google.com")
'Set the Uri action
bookmark.Action = uriAction
'Save and close the PDF document.
Document.Save("Output.pdf")
Document.Close(True)
Remarks
The PdfAction works only when destination of bookmark is not set.
- See Also
Color
Gets or sets the color of bookmark title.
public virtual PdfColor Color { get; set; }
Property Value
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = document.Bookmarks.Add("Page 1");
//Set the destination page.
bookmark.Destination = new PdfDestination(page);
//Set the destination location.
bookmark.Destination.Location = new PointF(20, 20);
//Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold;
bookmark.Color = Color.Red;
//Save and close the PDF document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = document.Bookmarks.Add("Page 1")
'Set the destination page.
bookmark.Destination = New PdfDestination(page)
'Set the destination location.
bookmark.Destination.Location = New PointF(20, 20)
'Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold
bookmark.Color = Color.Red
'Save and close the PDF document.
document.Save("Output.pdf")
document.Close(True)
- See Also
Destination
Gets or sets the outline destination page.
public virtual PdfDestination Destination { get; set; }
Property Value
- PdfDestination
The PdfDestination object is to be navigated.
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = document.Bookmarks.Add("Page 1");
//Set the destination page.
bookmark.Destination = new PdfDestination(page);
//Set the destination location.
bookmark.Destination.Location = new PointF(20, 20);
//Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold;
bookmark.Color = Color.Red;
//Save and close the PDF document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = document.Bookmarks.Add("Page 1")
'Set the destination page.
bookmark.Destination = New PdfDestination(page)
'Set the destination location.
bookmark.Destination.Location = New PointF(20, 20)
'Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold
bookmark.Color = Color.Red
'Save and close the PDF document.
document.Save("Output.pdf")
document.Close(True)
- See Also
IsExpanded
Gets or sets the whether to expand the node or not.
public bool IsExpanded { get; set; }
Property Value
- bool
true If the bookmark is expandable , otherwise false.
Examples
//Create a new document.
PdfDocument Document = new PdfDocument();
//Add a page.
PdfPage page = Document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = Document.Bookmarks.Add("page1");
//Set color.
bookmark.Color = Color.Red;
bool expand = bookmark.IsExpanded;
//Create a Uri action
PdfUriAction uriAction = new PdfUriAction("http://www.google.com");
//Set the Uri action
bookmark.Action = uriAction;
//Save and close the PDF document.
Document.Save("Output.pdf");
Document.Close(true);
'Create a new document.
Dim Document As New PdfDocument()
'Add a page.
Dim page As PdfPage = Document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = Document.Bookmarks.Add("page1")
'Set color.
bookmark.Color = Color.Red
bool expand = bookmark.IsExpanded
'Create a Uri action
Dim uriAction As New PdfUriAction("http://www.google.com")
'Set the Uri action
bookmark.Action = uriAction
'Save and close the PDF document.
Document.Save("Output.pdf")
Document.Close(True)
- See Also
NamedDestination
Gets or sets the named destination in outline.
public virtual PdfNamedDestination NamedDestination { get; set; }
Property Value
- PdfNamedDestination
The PdfNamedDestination object is to be navigated.
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = document.Bookmarks.Add("Page");
//Create a named destination.
PdfNamedDestination namedDestination = new PdfNamedDestination("Page 1");
//Set the named destination location.
namedDestination.Destination = new PdfDestination(page, new PointF(100, 300));
//Add the named destination
document.NamedDestinationCollection.Add(namedDestination);
//Set the named destination.
bookmark.NamedDestination = namedDestination;
//Save and close the PDF document.
document.Save("NamedDestination.pdf");
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = document.Bookmarks.Add("Page")
'Create a named destination.
Dim namedDestination As PdfNamedDestination = New PdfNamedDestination("Page 1")
'Set the named destination location.
namedDestination.Destination = New PdfDestination(page, new PointF(100, 300));
'Add the named destination
document.NamedDestinationCollection.Add(namedDestination);
'Set the named destination
bookmark.NamedDestination = namedDestination;
'Save and close the PDF document.
document.Save("NamedDestination.pdf")
document.Close(True)
- See Also
TextStyle
Gets or sets the style of the outline title.
public virtual PdfTextStyle TextStyle { get; set; }
Property Value
- PdfTextStyle
The PdfTextStyle object which selects the text style of bookmark title
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = document.Bookmarks.Add("Page 1");
//Set the destination page.
bookmark.Destination = new PdfDestination(page);
//Set the destination location.
bookmark.Destination.Location = new PointF(20, 20);
//Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold;
bookmark.Color = Color.Red;
//Save and close the PDF document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = document.Bookmarks.Add("Page 1")
'Set the destination page.
bookmark.Destination = New PdfDestination(page)
'Set the destination location.
bookmark.Destination.Location = New PointF(20, 20)
'Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold
bookmark.Color = Color.Red
'Save and close the PDF document.
document.Save("Output.pdf")
document.Close(True)
- See Also
Title
Gets or sets the outline title.
public virtual string Title { get; set; }
Property Value
- string
A string value which contains the bookmark title
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document bookmarks.
PdfBookmark bookmark = document.Bookmarks.Add("Page 1");
//Set the destination page.
bookmark.Destination = new PdfDestination(page);
//Set the destination location.
bookmark.Destination.Location = new PointF(20, 20);
//Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold;
bookmark.Color = Color.Red;
//Set the Bookmark Title.
bookmark.Title = "Bookmark";
//Save and close the PDF document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
'Create document bookmarks.
Dim bookmark As PdfBookmark = document.Bookmarks.Add("Page 1")
'Set the destination page.
bookmark.Destination = New PdfDestination(page)
'Set the destination location.
bookmark.Destination.Location = New PointF(20, 20)
'Set the text style and color.
bookmark.TextStyle = PdfTextStyle.Bold
bookmark.Color = Color.Red
'Set the bookmark title.
bookmark.Title = "Bookmark"
'Save and close the PDF document.
document.Save("Output.pdf")
document.Close(True)
Remarks
The outline title is the text, which appears in the outline tree as a tree node.
- See Also