Method AddLink

Namespace
SoftZenPdf
Assembly
SoftZenPdf.dll

Makes a rectangular area of the page a link to a web address or other URI.

public void AddLink(double x, double y, double width, double height, Uri uri, bool showBorder = false, PdfColor? borderColor = null)

Parameters

x double

Left edge of the clickable area, in points.

y double

Bottom edge of the clickable area, in points.

width double

Width of the area, in points.

height double

Height of the area, in points.

uri Uri

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

showBorder bool

Whether to draw a 1-point black border around the area.

borderColor PdfColor?

The border colour; giving a colour also turns the border on. The border is drawn by the link's own appearance, so it shows in every viewer.

The link is invisible apart from the optional border; draw the link text yourself, or use DrawLink(string, double, double, PdfFont, double, Uri, PdfColor?, bool) to draw text and link together.

Exceptions

ArgumentException

uri is relative.

Makes a rectangular area of the page a link to another page of the same document.

public void AddLink(double x, double y, double width, double height, PdfPage target, double? top = null, bool showBorder = false, PdfColor? borderColor = null)

Parameters

x double

Left edge of the clickable area, in points.

y double

Bottom edge of the clickable area, in points.

width double

Width of the area, in points.

height double

Height of the area, 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.

showBorder bool

Whether to draw a 1-point black border around the area.

borderColor PdfColor?

The border colour; giving a colour also turns the border on. The border is drawn by the link's own appearance, so it shows in every viewer.

Exceptions

ArgumentException

target belongs to a different document.