New to Telerik UI for WinUI? Download free 30-day trial

Link Annotations

The PdfViewer provides read-only support for link annotations. This means that if you open a PDF file that includes hyperlinks to absolute URIs and click them, a window navigates to the respective address.

In addition, you can include links to bookmarks in the same document and, when clicked, the viewport will scroll to the respective destination within the document.

Link annotations are part of the Telerik RadPdfProcessing library which is used for the document model of the PdfViewer.

A clicked link annotation

To get the link annotations in the document, use the Annotation collection property of the RadFixedDocument.

Get the link annotations

IEnumerable<Link> annotations = this.pdfViewer.Document.Annotations.OfType<Link>(); 
 
// The address of the link annotation can be access through its Action property. 
Link link = annotations.ElementAt(0); 
UriAction action = (UriAction)link.Action; 
Uri address = action.Uri; 
Destination destination = action.Destination;    
The behavior of the annotation is determined by its Action property. The Uri property of the action tells what is the external address that the annotation click will open. The Destination points to a bookmark within the loaded document.

To replace or cancel the action that happens on link click, use the AnnotationClick event of the RadPdfViewer.

Cancel the link click navigation

private void PdfViewer_AnnotationClicked(object sender, Telerik.Windows.Documents.Fixed.Model.Annotations.EventArgs.AnnotationEventArgs e) 
{ 
    // Cancel the go-to action of the link.             
    e.Handled = true; 
 
    RadFixedPage page = e.Page; 
    Link link = (Link)e.Annotation; 
    // Here you can implement any custom logic that will happen on annotation click. 
} 

See Also

In this article
Not finding the help you need?