Insert Hyperlink into the RadFixedDocument
Product Version | Product | Author |
---|---|---|
2021.2.507 | RadPdfProcessing | Martin Velikov |
Description
This article describes how to insert a Hyperlink into the RadFixedDocument.
Solution
The following example shows how to insert a Hyperlink using a Link annotation with an associated UriAction in the RadFixedDocument. With the help of the FixedContentEditor, we are drawing a block containing the text over the annotation.
Insert Hyperlink into RadFixedDocument
RadFixedDocument document = new RadFixedDocument();
RadFixedPage firstPage = document.Pages.AddPage();
FixedContentEditor editor = new FixedContentEditor(firstPage);
editor.Position.Translate(70, 10);
Block block = new Block();
block.GraphicProperties.FillColor = new RgbColor(255, 5, 99, 193);
block.InsertText("Telerik Website");
Size blockSize = block.Measure();
editor.DrawBlock(block);
UriAction uriAction = new UriAction();
uriAction.Uri = new Uri(@"http://www.telerik.com");
Link uriLink = firstPage.Annotations.AddLink(uriAction);
uriLink.Rect = new Rect(70, 10, blockSize.Width, blockSize.Height);