This sample shows how to add hyperlink on a page of your PDF document using PdfPage.AddHyperlink() method.

AddHyperlink method accepts bounds of an area to be occupied by hyperlink and a target URI to open when hyperlink is activated.

You can also add a hyperlink on a PDF page using PdfUriAction object.

C#
using System;
using System.Diagnostics;
using System.Drawing;

namespace BitMiracle.Docotic.Pdf.Samples
{
    public static class Hyperlink
    {
        public static void Main()
        {
            // NOTE: 
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "Hyperlink.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                pdf.AutoCreateUriActions = true;

                PdfPage page = pdf.Pages[0];
                page.Canvas.DrawString(10, 50, "Url: http://bitmiracle.com");

                RectangleF rectWithLink = new RectangleF(10, 70, 200, 100);
                page.Canvas.DrawRectangle(rectWithLink, PdfDrawMode.Stroke);
                page.Canvas.DrawString("Go to Google", rectWithLink, PdfTextAlign.Center, PdfVerticalAlign.Center);
                page.AddHyperlink(rectWithLink, new Uri("http://google.com"));

                pdf.Save(pathToFile);
            }

            Process.Start(pathToFile);
        }
    }
}
VB
Imports System
Imports System.Diagnostics
Imports System.Drawing

Imports BitMiracle.Docotic.Pdf

Namespace BitMiracle.Docotic.Pdf.Samples
    Public NotInheritable Class Hyperlink
        Public Shared Sub Main()
            ' NOTE: 
            ' When used in trial mode, the library imposes some restrictions.
            ' Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            ' for more information.

            Dim pathToFile As String = "Hyperlink.pdf"

            Using pdf As New PdfDocument()
                pdf.AutoCreateUriActions = True

                Dim page As PdfPage = pdf.Pages(0)
                page.Canvas.DrawString(10, 50, "Url: http://bitmiracle.com")

                Dim rectWithLink As New RectangleF(10, 70, 200, 100)
                page.Canvas.DrawRectangle(rectWithLink, PdfDrawMode.Stroke)
                page.Canvas.DrawString("Go to Google", rectWithLink, PdfTextAlign.Center, PdfVerticalAlign.Center)
                page.AddHyperlink(rectWithLink, New Uri("http://google.com"))

                pdf.Save(pathToFile)
            End Using

            Process.Start(pathToFile)
        End Sub
    End Class
End Namespace