Class PdfNamedDestinationCollection
Implements a collection of named destinations in the document.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfNamedDestinationCollection : IEnumerable, IPdfWrapper
Constructors
PdfNamedDestinationCollection()
Initializes a new instance of the PdfNamedDestinationCollection class.
Declaration
public PdfNamedDestinationCollection()
Properties
Count
Gets number of the elements in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total number of elements in the collection. |
Item[Int32]
Gets the PdfNamedDestination at the specified index.
Declaration
public PdfNamedDestination this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
PdfNamedDestination |
Methods
Add(PdfNamedDestination)
Creates and adds a named destination.
Declaration
public void Add(PdfNamedDestination namedDestination)
Parameters
Type | Name | Description |
---|---|---|
PdfNamedDestination | namedDestination |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document named destinations.
PdfNamedDestination namedDestination = new PdfNamedDestination("Page 1");
//Set the destination page.
namedDestination.Destination = new PdfDestination(page);
//Set the destination location.
namedDestination.Destination.Location = new PointF(20, 20);
//Add the named destination.
document.NamedDestinationCollection.Add(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 named destinations.
Dim namedDestination As PdfNamedDestination = New PdfNamedDestination("Page 1")
'Set the destination page.
namedDestination.Destination = New PdfDestination(page)
'Set the destination location.
namedDestination.Destination.Location = New PointF(20, 20)
'Add the named destination.
document.NamedDestinationCollection.Add(namedDestination)
'Save and close the PDF document.
document.Save("NamedDestination.pdf")
document.Close(True)
Clear()
Removes all the named destination from the collection.
Declaration
public void Clear()
Examples
//Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the Named destinations
PdfNamedDestinationCollection namedCollection = loadedDocument.NamedDestinationCollection;
//Remove all the named destination form the collection
namedCollection.Clear();
//Save and close the PDF document
loadedDocument.Save("NamedDestination.pdf");
loadedDocument.Close(true);
'Load the PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the Named destination
Dim namedCollection As PdfNamedDestinationCollection = loadedDocument.NamedDestinationCollection
'Remove all the named destination form the collection
namedCollection.Clear()
'Save and close the document
loadedDocument.Save("NamedDestination.pdf")
loadedDocument.Close(True)
Contains(PdfNamedDestination)
Determines whether the specified named destinations presents in the collection.
Declaration
public bool Contains(PdfNamedDestination namedDestination)
Parameters
Type | Name | Description |
---|---|---|
PdfNamedDestination | namedDestination |
Returns
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
//Create document named destinations.
PdfNamedDestination namedDestination = new PdfNamedDestination("Page 1");
//Set the destination page.
namedDestination.Destination = new PdfDestination(page);
//check whether the specified named destination present in the collection
document.NamedDestinationCollection.Contains(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 named destinations.
Dim namedDestination As PdfNamedDestination = New PdfNamedDestination("Page 1")
'Set the destination page.
namedDestination.Destination = New PdfDestination(page)
'Set the destination location.
namedDestination.Destination.Location = New PointF(20, 20)
'check whether the specified named destination present in the collection
Dim isNamedDestinationContained As Boolean = document.NamedDestinationCollection.Contains(namedDestination)
'Save and close the PDF document.
document.Save("NamedDestination.pdf")
document.Close(True)
Insert(Int32, PdfNamedDestination)
Inserts a new named destination at the specified index.
Declaration
public void Insert(int index, PdfNamedDestination namedDestination)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
PdfNamedDestination | namedDestination |
Examples
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Insert a new named destination in the existing named destinations.
PdfNamedDestination namedDestination = new PdfNamedDestination("Page 2");
//Set the destination page and location.
namedDestination.Destination = new PdfDestination(loadedDocument.Pages[0]);
namedDestination.Destination.Location = new PointF(0, 300);
//Insert the named destination
loadedDocument.NamedDestinationCollection.Insert(1, namedDestination);
//Save and close the PDF document.
loadedDocument.Save("NamedDestination.pdf");
loadedDocument.Close(true);
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Insert a new named destination in the existing named destinations.
Dim namedDestination As PdfNamedDestination = New PdfNamedDestination("Page 2")
'Set the destination page and location.
namedDestination.Destination = New PdfDestination(loadedDocument.Pages(0))
namedDestination.Destination.Location = New PointF(0, 300)
Insert the named destination
loadedDocument.NamedDestinationCollection.Insert(1, namedDestination)
'Save and close the PDF document.
loadedDocument.Save("NamedDestination.pdf")
loadedDocument.Close(True)
Remove(String)
Remove the specified named destination from the document.
Declaration
public void Remove(string title)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | The title of the named destination. |
Examples
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get all the named destinations.
PdfNamedDestinationCollection namedCollection = loadedDocument.NamedDestinationCollection;
//Remove named destination by named destination name.
namedCollection.Remove("Page 1");
//Remove named destination by index.
namedCollection.RemoveAt(1);
//Save and close the document.
loadedDocument.Save("NamedDestination.pdf");
loadedDocument.Close(true);
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("input.pdf")
'Get all the named destinations.
Dim namedCollection As PdfNamedDestinationCollection = loadedDocument.NamedDestinationCollection
'Remove named destination by named destination name.
namedCollection.Remove("Page 1")
'Remove named destination by index.
namedCollection.RemoveAt(1)
'Save and close the document.
loadedDocument.Save("NamedDestination.pdf")
loadedDocument.Close(True)
RemoveAt(Int32)
Remove the specified named destination from the document.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Examples
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get all the named destinations.
PdfNamedDestinationCollection namedCollection = loadedDocument.NamedDestinationCollection;
//Remove named destination by named destination name.
namedCollection.Remove("Page 1");
//Remove named destination by index.
namedCollection.RemoveAt(1);
//Save and close the document.
loadedDocument.Save("NamedDestination.pdf");
loadedDocument.Close(true);
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("input.pdf")
'Get all the named destinations.
Dim namedCollection As PdfNamedDestinationCollection = loadedDocument.NamedDestinationCollection
'Remove named destination by named destination name.
namedCollection.Remove("Page 1")
'Remove named destination by index.
namedCollection.RemoveAt(1)
'Save and close the document.
loadedDocument.Save("NamedDestination.pdf")
loadedDocument.Close(True)
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |