# Links

Add links in your PDF document to jump from one location to the other, within the document or outside the document using DsPdf.

## Content

Among all the static content of a PDF, links are required to jump from one location to other location within the document or outside the document. Creating hyperlinks is one such way which not only helps in navigating through the content but also makes it interactive. For more information on link annotations, see <span data-teams="true">PDF Specification 2.0</span> (Section 12.5.6.5).
DsPdf allows you to add hypertext links to a PDF document through [LinkAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.LinkAnnotation.html) class.
![LinksAnnotation](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/hyperlink.gif)

## Add Hyperlink

To add a hyperlink in a PDF document, use the [LinkAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.LinkAnnotation.html) class. The LinkAnnotation class provides essential properties for creating a hyperlink.
To add a hyperlink:

1. Create an object of [GcPdfDocument](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.GcPdfDocument.html) class.
2. Draw text to represent the hyperlink.
3. Pass the instance of [LinkAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.LinkAnnotation.html) class as a parameter to the **Add** method.

    ```csharp
    public void CreatePDF(Stream stream)
    {
        GcPdfDocument doc = new GcPdfDocument();
        var page = doc.NewPage();
        var g = page.Graphics;
    
        // Draw some text that will represent the link
        var tf = new TextFormat()
        {
            Font = StandardFonts.Times,
            FontSize = 14
        };
        var tl = new TextLayout();
        tl.MarginLeft = tl.MarginTop = tl.MarginRight = tl.MarginBottom = 72;
        tl.Append("Google google on the wall, please tell me all!", tf);
        tl.PerformLayout(true);
        g.DrawTextLayout(tl, PointF.Empty);
    
        // Add a link associated with the text area
        page.Annotations.Add
        (new LinkAnnotation(tl.ContentRectangle, new ActionURI("http://www.google.com")));
    
        // Done
        doc.Save(stream);
    }
    ```

For more information about implementation of links using DsPdf, see [DsPdf sample browser](https://developer.mescius.com/documents-api-pdf/demos/basics/navigation/link-to-url/code-cs).