Link

Represents a link with a destination or action.

public class Link : TaggablePageElement, IAnnotation, IArea, ICoordinate, ISerializable
Public Class Link
    Inherits TaggablePageElement
    Implements IAnnotation, IArea, ICoordinate, ISerializable

Inheritance: ObjectPageElementTaggablePageElementLink

Implements: IAnnotation, IArea, ICoordinate, ISerializable

Derived: AutoLink

Licensing Info

This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

The following example will place a label on the PDF then create a link at that location that links to a webpage.
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 mydomain.com"
        Dim MyFont As Font = Font.Helvetica
     
        ' Create the link's label
        Dim MyLabel As Label = New Label(MyText, 50, 50, 400, 20, MyFont, 18, _
     	RgbColor.Blue)
        MyLabel.Underline = True
     
        ' Set the action then create the link
        Dim action As UrlAction = New UrlAction("http://www.mydomain.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
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
    public static void CreatePDF(string outputPath)
    {
        // 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 mydomain.com";
        Font font = Font.Helvetica;

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

        // Set the action then create the link
        UrlAction action = new UrlAction( "http://www.mydomain.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( outputPath );
    }
}

Remarks

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

NOTE: This page element cannot be used within a table cell, or transformation group.

Constructors

Link(Single, Single, Single, Single, Action)Initializes a new instance of the Link class.

Properties

ActionGets the Action to be taken by the link.
AlternateDescriptionGets or sets the alternate description of the link.
HeightGets or sets the height of the link.
IDGets or sets the ID of the page element.
(Inherited from PageElement)
IgnoreMarginsGets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property.
(Inherited from PageElement)
RelativeToGets and sets placement of the page element on the page.
(Inherited from PageElement)
TagGets or sets the structure element of the link.
TagOrderGets or sets the tag order of the taggable element.
(Inherited from TaggablePageElement)
WidthGets or sets the width of the link.
XGets or sets the X coordinate of the link.
YGets or sets the Y coordinate of the link.

Methods

Draw(PageWriter)Draws the link to the given PageWriter object.
DrawAnnotation(DocumentWriter)Draws the link to the given DocumentWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.PageElements

In this topic