Documents in PDF or SVG format can include links; these can be either “local” links to a different part of the document, or links to some URL on the internet.
To create a link in VectSharp, you can use the tag feature. You may have noticed that most drawing calls (e.g. FillRectangle, StrokeRectangle, FillPath, StrokePath, etc.) accept an optional tag parameter, which is a string whose default value is null. This parameter is used to identify elements in the plot. When you export the image using the SaveAsSVG or SaveAsPDF methods, you can supply an optional Dictionary<string, string> parameter (linkDestinations), which associates the tags to the corresponding link.
If a tag is associated with a link that starts with a hash (#) symbol, the link is interpreted as being an internal link to the object whose tag corresponds to the linked tag; otherwise, the link is interpreted as an external link.
The following example shows how to create an external link in an SVG image:
The following example, instead, shows how to create a PDF file with an internal link. Note that internal links are supported in SVG as well, but they are only useful if the SVG image is large enough that it does not fit on the screen. In a PDF document, instead, links can be made to point at different pages.