Class PdfBookmark
Each instance of this class represents an bookmark node in the bookmark tree.
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.UWP.dll
Syntax
public class PdfBookmark : PdfBookmarkBase, IPdfWrapper, IEnumerable
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.
Declaration
public PdfAction Action { get; set; }
Property Value
Type |
---|
PdfAction |
Remarks
The PdfAction works only when destination of bookmark is not set.
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)
See Also
Color
Gets or sets the color of bookmark title.
Declaration
public virtual PdfColor Color { get; set; }
Property Value
Type | Description |
---|---|
PdfColor | The PdfColor which draws the outline of 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;
//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.
Declaration
public virtual PdfDestination Destination { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public bool IsExpanded { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | 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.
Declaration
public virtual PdfNamedDestination NamedDestination { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public virtual PdfTextStyle TextStyle { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public virtual string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value which contains the bookmark title |
Remarks
The outline title is the text, which appears in the outline tree as a tree node.
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)