Method AddLink
- Namespace
- SoftZenPdf
- Assembly
- SoftZenPdf.dll
AddLink(double, double, double, double, Uri, bool, PdfColor?)
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
xdoubleLeft edge of the clickable area, in points.
ydoubleBottom edge of the clickable area, in points.
widthdoubleWidth of the area, in points.
heightdoubleHeight of the area, in points.
uriUriAn absolute URI, such as
https://example.com/ormailto:hello@example.com.showBorderboolWhether to draw a 1-point black border around the area.
borderColorPdfColor?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.
Remarks
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
uriis relative.
AddLink(double, double, double, double, PdfPage, double?, bool, PdfColor?)
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
xdoubleLeft edge of the clickable area, in points.
ydoubleBottom edge of the clickable area, in points.
widthdoubleWidth of the area, in points.
heightdoubleHeight of the area, in points.
targetPdfPageThe page to jump to.
topdouble?The y coordinate to scroll to on the target page; null shows the whole page.
showBorderboolWhether to draw a 1-point black border around the area.
borderColorPdfColor?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
targetbelongs to a different document.