Represents a link with a destination or action.

For a list of all members of this type, see Link Members


System.Object
   ceTe.DynamicPDF.PageElement
public class Link : PageElement, IAnnotation, IArea, ICoordinate

Remarks

This class can be used to place links on the PDF.

Example

The following example will place a label on the PDF then create a link at that location that links to a webpage.

[Visual Basic]
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements

Module MyModule
        
    Sub Main()
        
        ' Create a PDF Document
        Dim MyDocument As Document = New Document 
        
        ' Create a Page and add it to the document
        Dim MyPage As Page = New Page
        MyDocument.Pages.Add(MyPage)

        Dim MyText As String = "This is a link to DynamicPDF.com"
        Dim MyFont As Font = Font.Helvetica

        ' Create the link's label
        Dim MyLabel As Label = New Label(MyText, 50, 50, 400, 20, font, 18, _
            Color.Blue)
        MyLabel.Underline = True

        ' Set the action then create the link
        Dim action As UrlAction = New UrlAction("http://www.dynamicpdf.com")
        Dim MyLink As Link = New Link(50, 50, MyFont.GetTextWidth(MyText, 18), _
            20, Action)

        ' Add the label and the link to the page
        MyPage.Elements.Add(MyLabel)
        MyPage.Elements.Add(MyLink)

        ' Save the PDF
        MyDocument.Draw("C:\MyDocument.pdf")
        
    End Sub
End Module
[C#]
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

class MyClass
{
    static void Main()
    {
        // Create a PDF Document
        Document document = new Document();

        // Create a Page and add it to the document
        Page page = new Page();
        document.Pages.Add( page );

        string text = "This is a link to DynamicPDF.com";
        Font font = Font.Helvetica;

        // Create the link's label
        Label label = new Label( text, 50, 50, 400, 20, font, 18, 
            Color.Blue );
        label.Underline = true;

        // Set the action then create the link
        UrlAction action = new UrlAction( "http://www.dynamicpdf.com" );
        Link link = new Link( 50, 50, font.GetTextWidth( text, 18 ), 20, 
            action );

        // Add the label and the link to the page
        page.Elements.Add( label );
        page.Elements.Add( link );

        // Save the PDF
        document.Draw( @"C:\MyDocument.pdf" );
    }
}

Requirements

Namespace: ceTe.DynamicPDF.PageElements Namespace

Assembly: DynamicPDF.Generator.[Edition].dll

See Also

Link members | ceTe.DynamicPDF.PageElements Namespace