Skip to main content
All docs
V26.1
  • LinkAnnotation Class

    Contains settings for a link annotation.

    Namespace: DevExpress.Docs.Pdf

    Assembly: DevExpress.Docs.Pdf.v26.1.dll

    Declaration

    public class LinkAnnotation :
        BaseAnnotation

    Example

    DevExpress PDF Document API - Wrap a Text with a Link Annotations

    FileStream fs = File.OpenRead("Demo.pdf");
    var options = new LoadOptions();
    PdfDocument document = new PdfDocument(fs, options);
    Page page = document.Pages[0];
    
    var searchResults = document.FindText("PDF Viewer", 0, 0).ToArray();
    
    RectangleF textRect = searchResults[0].Groups[0].Matches[0].MatchFragment.Rectangle.BoundingBox;
    
    LinkAnnotation linkAnnotation = new(textRect) {
        Action = new UriAction { Uri = "https://www.devexpress.com" },
        HighlightingMode = AnnotationHighlightingMode.Invert
    };
    
    page.Annotations.Add(linkAnnotation);
    
    document.Save(new FileStream("Demo2.pdf", FileMode.Create, FileAccess.Write));
    

    Implements

    Inheritance

    Object
    BaseAnnotation
    LinkAnnotation
    See Also