'' This code is part of Document Solutions for PDF samples.
'' Copyright (c) MESCIUS inc. All rights reserved.
Imports System.IO
Imports System.Drawing
Imports System.Numerics
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text
Imports GrapeCity.Documents.Drawing
Imports GrapeCity.Documents.Pdf.Annotations
Imports GrapeCity.Documents.Pdf.Actions

'' A simple way to create a link to an external URL,
'' and associate it with a text on a page.
Public Class LinkToURL
    Function CreatePDF(ByVal stream As Stream) As Integer
        Dim doc = New GcPdfDocument()
        Dim page = doc.NewPage()
        Dim g = page.Graphics

        '' Draw some text that will represent the link:
        Dim tl = g.CreateTextLayout()
        tl.MarginAll = 72
        tl.Append("Google google on the wall, please tell me all!",
                  New TextFormat() With {.Font = StandardFonts.Times, .FontSize = 14})
        g.DrawTextLayout(tl, PointF.Empty)

        '' Add a link associated with the text area:
        page.Annotations.Add(New LinkAnnotation(tl.ContentRectangle, New ActionURI("")))
        '' Done:
        Return doc.Pages.Count
    End Function
End Class