Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Named Destinations

Named destinations are destinations in the document which can be referred to indirectly by means of a name object or a byte string.

NamedDestination Class

The NamedDestination class is the one that represents the named destinations in PDF documents. It exposes the following properties:

  • Name: Gets or sets the destination name. Changing this property also affects the name of the named destination inside the document collection.

  • Destination: Property of type Destination, which determines the actual destination the named destination points to.

  • GoToAction: Gets or sets the GoToAction of the named destination.

NamedDestinations Collection

The NamedDestinations collection is exposed by RadFixedDocument and is used to add, remove, modify and iterate the NamedDestination objects in a PDF document. This collection implements IEnumerable and you can obtain a NamedDestination using its name.

Create

NamedDestination objects can be created through the Add() method of the NamedDestinations collection exposed by RadFixedDocument.

Example 1: Create NamedDestination with Destination of type Link

this.pdfDocument.NamedDestinations.Add("myNamedDest", new Location() { Page = this.pdfDocument.Pages[0], Left = 50, Top = 150 }); 

Remove

You can remove a named destination as you would do with any item in a collection.

Example 2: Remove NamedDestination

 this.pdfDocument.NamedDestinations.Remove("myNamedDest"); 

Rename

In addition to the Name property of the NamedDestination class which provides you with a setter, you can use the Rename() method of the RadFixedDocument.NamedDestinations collection.

Example 3: Remove NamedDestination

 this.pdfDocument.NamedDestinations.Rename("myNamedDest", "Chapter1"); 

Check If a Name Exists

The NamedDestinations collection provides you with the ContainsName() method which is convenient to check whether the name you would like to use has been already applied to a NamedDestination or to check whether the NamedDestination you are searching for exists.

Example 4: Check if a NamedDestination already exists

 this.pdfDocument.NamedDestinations.ContainsName("myNamedDest"); 

See Also

In this article