Method DrawLink
- Namespace
- SoftZenPdf
- Assembly
- SoftZenPdf.dll
DrawLink(string, double, double, PdfFont, double, Uri, PdfColor?, bool)
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
textstringThe link text, drawn on one line.
xdoublex of the start of the baseline, in points.
ydoubley of the baseline, in points.
fontPdfFontThe font of the text.
sizedoubleFont size, in points.
uriUriAn absolute URI, such as
https://example.com/ormailto:hello@example.com.colorPdfColor?The text and underline colour; defaults to the usual browser link blue (#0000EE).
underlineboolWhether to underline the text.
Returns
- double
The width of the text, in points, for placing whatever follows it on the line.
Remarks
The clickable area covers the text's width and about 1.2 times the font size in height.
Exceptions
- ArgumentException
uriis relative, or the font cannot show a character oftext.
DrawLink(string, double, double, PdfFont, double, PdfPage, double?, PdfColor?, bool)
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
textstringThe link text, drawn on one line.
xdoublex of the start of the baseline, in points.
ydoubley of the baseline, in points.
fontPdfFontThe font of the text.
sizedoubleFont size, in points.
targetPdfPageThe page to jump to.
topdouble?The y coordinate to scroll to on the target page; null shows the whole page.
colorPdfColor?The text and underline colour; defaults to the usual browser link blue (#0000EE).
underlineboolWhether to underline the text.
Returns
- double
The width of the text, in points, for placing whatever follows it on the line.
Remarks
The clickable area covers the text's width and about 1.2 times the font size in height.
Exceptions
- ArgumentException
targetbelongs to a different document, or the font cannot show a character oftext.