Skip to main content

Link

Version: 6.0

cete.dynamicpdf.pageelements.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: Object → PageElement → TaggablePageElement → Link

Implements: IAnnotation, IArea, ICoordinate, ISerializable

Licensing​

This class is a DynamicPDF Generator Professional Edition feature. One of the following licenses is required for non-evaluation usage:

  • DynamicPDF Generator for .NET Professional Edition
  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Professional Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Professional Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Professional Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

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 DynamicPDF.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.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
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, RgbColor.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" );}
}

Remarks​

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

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

Constructors​

Link(Single, Single, Single, Single, Action)​

Initializes a new instance of the Link class.

public Link(float x, float y, float width, float height, Action action)
Public Sub New (x As Single, y As Single, width As Single, height As Single, action As Action)

Parameters​

X coordinate of the link.

Y coordinate of the link.

Width of the link.

Height of the link.

Action or destination of the link.

Properties​

Action​

Gets the Action to be taken by the link.

public Action Action { get; }
Public Property Action As Action

Property Value​

Action

Height​

Gets or sets the height of the link.

public float Height { get; set; }
Public Property Height As Single

Property Value​

Single

ID​

Gets or sets the ID of the page element. (Inherited from PageElement)

public string ID { get; set; }
Public Property ID As String

Property Value​

String

Tag​

Gets or sets the structure element of the link.

public Tag Tag { get; set; }
Public Property Tag As Tag

Property Value​

Tag

Licensing​

This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:

  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

TagOrder​

Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)

public int TagOrder { get; set; }
Public Property TagOrder As Int32

Property Value​

Int32

Width​

Gets or sets the width of the link.

public float Width { get; set; }
Public Property Width As Single

Property Value​

Single

X​

Gets or sets the X coordinate of the link.

public float X { get; set; }
Public Property X As Single

Property Value​

Single

Y​

Gets or sets the Y coordinate of the link.

public float Y { get; set; }
Public Property Y As Single

Property Value​

Single

Methods​

Draw(PageWriter)​

Draws the link to the given PageWriter object.

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the link's output.

DrawAnnotation(DocumentWriter)​

Draws the link to the given DocumentWriter object.

public void DrawAnnotation(DocumentWriter writer)
Sub DrawAnnotation(writer As DocumentWriter)

Parameters​

DocumentWriter object to receive the link's output.

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF.PageElements