Skip to main content
All docs
V24.1

PdfLinkAnnotationFacade.SetUri(String) Method

Sets a URI string associated with the annotation.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.1.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public void SetUri(
    string uri
)

Parameters

Name Type Description
uri String

A URI string to which the link annotation refers.

Remarks

The code sample below changes the URI associated with the link annotation:

using DevExpress.Pdf;
using System.Linq;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document
    processor.LoadDocument("..\\..\\Demo.pdf");

    // Access the first page properties
    PdfPageFacade page = processor.DocumentFacade.Pages[0];

    // Retrieve all link annotations
    var linkAnnotations = page.Annotations.Where(annotation => annotation.Type == PdfAnnotationType.Link);
    foreach (PdfLinkAnnotationFacade linkAnnotation in linkAnnotations)
    {
        // Change URI of a specific annotation
        if (linkAnnotation.Name == "link1")
        {
            linkAnnotation.SetUri("https://docs.devexpress.com/");
        }
    }
    processor.SaveDocument("..\\..\\Result_1.pdf");
}
See Also