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

The Link class inherits the abstract Annotation class. Link annotations represent either a hypertext link to a destination elsewhere in the document or an action to be performed. For this reason, there are two separate constructors in the Link class - one requiring a Destination object and one requiring an Action object.

Link exposes the following properties:

  • Destination: A destination to be displayed when the annotation is activated. Example 1 demonstrates how you can create a Link using a previously created Destination and add the Link in RadFixedPage's Annotations collection.

    Example 1: Add link to destination

        Link linkWithDestination = new Link(destination); 
        page.Annotations.Add(linkWithDestination); 
    
  • NamedDestination: A named destination associated with the link.

  • Action: An action to be performed when the annotation is activated. Example 2 demonstrates how you can create a Link using a previously created Action and add the Link in RadFixedPage's Annotations collection.

    Example 2: Add link with action

        Link linkWithAction = new Link(action); 
        page.Annotations.Add(linkWithAction); 
    

In Example 2, the action object should be from the Telerik.Windows.Documents.Fixed.Model.Actions.Action type.

Destination

The abstract Destination class defines a particular view of a document, consisting of the following items:

  • The page, which needs to be displayed.
  • The location on that page.
  • The magnification (zoom) factor, which should be used when displaying the page.

The Destination class itself only exposes a Page property specifying the page of the destination. The other properties of the view are determined by the classes that inherit Destination.

  • Location: Exposes Left, Top and Zoom properties. Displays the specified page, positioned with the (Left, Top) position at the upper-left corner of the window and the contents of the page magnified by the factor Zoom.

  • PageFit: Displays the specified page with its contents magnified just enough to fit the entire page within the window both horizontally and vertically.

  • PageHorizontalFit: Exposes Top property. Displays the specified page with the vertical coordinate Top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window.

  • PageVerticalFit: Exposes Left property. Displays the specified page with the horizontal coordinate Left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window.

  • RectangleFit: Exposes Left, Top, Right and Bottom properties. Displays the specified page with its contents magnified just enough to fit the rectangle specified by the coordinates Left, Bottom, Right and Top entirely within the window both horizontally and vertically.

  • BoundingRectangleFit: Displays the specified page with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically.

  • BoundingRectangleHorizontalFit: Exposes Top property. Displays the specified page with the vertical coordinate Top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window.

  • BoundingRectangleVerticalFit: Exposes Left property. Displays the specified page with the horizontal coordinate Left positioned at the left edge of the window and the contents of the page magnified just enough the fit the entire height of its bounding box within the window.

Example 3 shows how you can create a Location object, associate it with a Link and add it to a RadFixedPage.

Example 3: Add link with location

Location location = new Location(); 
location.Left = 225; 
location.Top = 500; 
location.Zoom = 4; 
location.Page = secondPage; 
 
var link = firstPage.Annotations.AddLink(location); 
link.Rect = new Rect(10, 10, 50, 50); 

Action

The abstract Action class defines a behavior for an annotation. Action is inherited from the following classes:

  • GoToAction: Associates the action with a Destination. The GoToAction class exposes the following properties:

    • Destination: The associated destination.
    • NamedDestination: The associated named destination.
  • UriAction: Associates the action with an Uri. The UriAction class exposes the following properties:

    • Uri: The associated Uri.
    • IncludeMouseCoordinates: Specifies whether to include the mouse coordinates as query parameters in the Uri.

Example 4 demonstrates how to create an action of type GoToAction, associate it with a Link and add it to a RadFixedPage. The location object can be of type Location like the one in Example 3.

Example 4: Add link with action

GoToAction goToAction = new GoToAction(); 
goToAction.Destination = location; 
 
var goToLink = firstPage.Annotations.AddLink(goToAction); 
goToLink.Rect = new Rect(10, 10, 50, 50); 
 
UriAction uriAction = new UriAction(); 
uriAction.Uri = new Uri(@"http://www.telerik.com"); 
 
var uriLink = firstPage.Annotations.AddLink(uriAction); 
uriLink.Rect = new Rect(70, 10, 50, 50); 

See Also

In this article