Class PdfNamedDestinationCollection
- Namespace
- Syncfusion.Pdf.Interactive
- Assembly
- Syncfusion.Pdf.Portable.dll
Implements a collection of named destinations in the document.
public class PdfNamedDestinationCollection : IEnumerable
- Inheritance
-
PdfNamedDestinationCollection
- Implements
- Inherited Members
Constructors
PdfNamedDestinationCollection()
Initializes a new instance of the PdfNamedDestinationCollection class.
public PdfNamedDestinationCollection()
Properties
Count
Gets number of the elements in the collection.
public int Count { get; }
Property Value
- int
The total number of elements in the collection.
this[int]
Gets the PdfNamedDestination at the specified index.
public PdfNamedDestination this[int index] { get; }
Parameters
index
int
Property Value
Methods
Add(PdfNamedDestination)
Creates and adds a named destination.
public void Add(PdfNamedDestination namedDestination)
Parameters
namedDestination
PdfNamedDestination
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.
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.
public bool Contains(PdfNamedDestination namedDestination)
Parameters
namedDestination
PdfNamedDestination
Returns
- bool
true
if the specified named destinations is in the collection; otherwise,false
.
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(int, PdfNamedDestination)
Inserts a new named destination at the specified index.
public void Insert(int index, PdfNamedDestination namedDestination)
Parameters
index
intThe index.
namedDestination
PdfNamedDestination
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.
public void Remove(string title)
Parameters
title
stringThe 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(int)
Remove the specified named destination from the document.
public void RemoveAt(int index)
Parameters
index
int
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)