Documents for PDF .NET Edition
Features / Links
In This Topic
    In This Topic

    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 PDF specification 1.7 (Section

    GcPdf allows you to add hypertext links to a PDF document through LinkAnnotation class.


    Add Hyperlink

    To add a hyperlink in a PDF document, use the LinkAnnotation class. The LinkAnnotation class provides essential properties for creating a hyperlink.

    To add a hyperlink:

    1. Create an object of GcPdfDocument class.
    2. Draw text to represent the hyperlink.
    3. Pass the instance of LinkAnnotation class as a parameter to the Add method.
      Copy Code
      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);
          g.DrawTextLayout(tl, PointF.Empty);
          // Add a link associated with the text area
          (new LinkAnnotation(tl.ContentRectangle, new ActionURI("")));
          // Done
    Back to Top

    For more information about implementation of links using GcPdf, see GcPdf sample browser.