Method DrawLink

Namespace
SoftZenPdf
Assembly
SoftZenPdf.dll

Draws a line of link text, optionally underlined, and makes it a link to a web address or other URI.

public double DrawLink(string text, double x, double y, PdfFont font, double size, Uri uri, PdfColor? color = null, bool underline = true)

Parameters

text string

The link text, drawn on one line.

x double

x of the start of the baseline, in points.

y double

y of the baseline, in points.

font PdfFont

The font of the text.

size double

Font size, in points.

uri Uri

An absolute URI, such as https://example.com/ or mailto:hello@example.com.

color PdfColor?

The text and underline colour; defaults to the usual browser link blue (#0000EE).

underline bool

Whether to underline the text.

Returns

double

The width of the text, in points, for placing whatever follows it on the line.

The clickable area covers the text's width and about 1.2 times the font size in height.

Exceptions

ArgumentException

uri is relative, or the font cannot show a character of text.

Draws a line of link text, optionally underlined, and makes it a link to another page of the same document.

public double DrawLink(string text, double x, double y, PdfFont font, double size, PdfPage target, double? top = null, PdfColor? color = null, bool underline = true)

Parameters

text string

The link text, drawn on one line.

x double

x of the start of the baseline, in points.

y double

y of the baseline, in points.

font PdfFont

The font of the text.

size double

Font size, in points.

target PdfPage

The page to jump to.

top double?

The y coordinate to scroll to on the target page; null shows the whole page.

color PdfColor?

The text and underline colour; defaults to the usual browser link blue (#0000EE).

underline bool

Whether to underline the text.

Returns

double

The width of the text, in points, for placing whatever follows it on the line.

The clickable area covers the text's width and about 1.2 times the font size in height.

Exceptions

ArgumentException

target belongs to a different document, or the font cannot show a character of text.