Skip to main content

AutoLink

Version: 12.0

cete.dynamicpdf.pageelements.autolink

Represents a link with a destination or action.

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

Inheritance: Object → PageElement → TaggablePageElement → Link → AutoLink

Implements: IAnnotation, IArea, ICoordinate, ISerializable

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 shows Auto Link placement.

Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements

Module MyModule

Sub Main()

' Create an Auto Layout
Dim MyAutoLayout As AutoLayout = New AutoLayout(PageSize.A4, PageOrientation.Portrait, 50)

' Create a Text Area
Dim label As TextArea = MyAutoLayout.AddText("TextArea Page Element:")
label.TextColor = RgbColor.Red

' Create an UrlAction
Dim action As UrlAction = New UrlAction("http://www.mydomain.com")

' Call AddAutoLink method from autoLayout object to get the link
Dim link As AutoLink = MyAutoLayout.AddAutoLink("CLICK HERE", action)
link.Label.TextColor = RgbColor.Blue
link.Label.FontSize = 18

' Call GetDocument method from autoLayout object to get the document
Dim document As Document = MyAutoLayout.GetDocument()

' 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 an Auto Layout
AutoLayout autoLayout = new AutoLayout(PageSize.A4, PageOrientation.Portrait, 50);

// Create a Text Area
TextArea label = autoLayout.AddText("Link Page Element:", false, 30);
label.TextColor = RgbColor.Red;

// Create an UrlAction
UrlAction action = new UrlAction("http://www.mydomain.com");

// Call AddAutoLink method from autoLayout object to get the link
AutoLink link = autoLayout.AddAutoLink("CLICK HERE", action);
link.Label.TextColor = RgbColor.Blue;
link.Label.FontSize = 18;

// Call GetDocument method from autoLayout object to get the document
Document document = autoLayout.GetDocument();

// 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.

Properties​

Action​

Gets the Action to be taken by the link. (Inherited from Link)

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

Property Value​

Action

Licensing Info​

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

AlternateDescription​

Gets or sets the alternate description of the link. (Inherited from Link)

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

Property Value​

String

Licensing Info​

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

Height​

Gets or sets the height of the link. (Inherited from Link)

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

Property Value​

Single

Licensing Info​

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

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

Licensing Info​

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

IgnoreMargins​

Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement)

public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean

Property Value​

Boolean

Licensing Info​

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

Examples​

The following example will place the Label in the top-left of the page with IgnoreMargin

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); // Create an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);

// Save the PDF
document.Draw(outputPath);
}
}

Label​

Gets or Sets the Label for the link.

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

Property Value​

Label

Licensing Info​

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

RelativeTo​

Gets and sets placement of the page element on the page. (Inherited from PageElement)

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

Property Value​

RelativeTo

Licensing Info​

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

Examples​

The following example will place the Label in the top-left of the page.

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); // Create an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);

// Save the PDF
document.Draw(outputPath);
}
}

Tag​

Gets or sets the structure element of the link. (Inherited from Link)

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

Property Value​

Tag

Licensing Info​

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

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

Licensing Info​

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

Width​

Gets or sets the width of the link. (Inherited from Link)

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

Property Value​

Single

Licensing Info​

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

X​

Gets or sets the X coordinate of the link. (Inherited from Link)

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

Property Value​

Single

Licensing Info​

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

Y​

Gets or sets the Y coordinate of the link. (Inherited from Link)

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

Property Value​

Single

Licensing Info​

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

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.

Licensing Info​

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

DrawAnnotation(DocumentWriter)​

Draws the link to the given DocumentWriter object. (Inherited from Link)

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

Parameters​

DocumentWriter object to receive the link's output.

Licensing Info​

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

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.

Licensing Info​

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

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 .

Licensing Info​

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

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.

Licensing Info​

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

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 .

Licensing Info​

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

See Also​

ceTe.DynamicPDF.PageElements