Hi Team,
I have a requirement to render image (as icon) with underline and hyperlink.
So user can click on image (icon) to navigate on another page in same pdf.
Thanks,
Chandan Singh
Image with underline and hyperlink
Re: Image with underline and hyperlink
Support · Jun 10, 2021Hello,
You can achieve this using the Link, Image and Line page elements. Please refer to the documentation on the Link
, Image
and Line
page elements.
Here a sample:
Document document = new Document();
Page page = new Page();
document.Pages.Add(page);
Page secondPage = new Page();
document.Pages.Add(secondPage);
//Adding link to the pages using Link and Image page elements.
Image linkImage = new Image(@"C:\FromD\temporary\Images\Winter.jpg", 100, 100);
linkImage.AlternateText = "Link to navigate to second page";
XYDestination action = new XYDestination(2,0,0);
Link link = new Link(100, 100, 100, 100, action);
linkImage.Width = 100;
linkImage.Height = 100;
//Adding unerline behavior using Line page element.
Line lineObj = new Line(linkImage.X, linkImage.Y + linkImage.Height + 2, linkImage.X + linkImage.Width, linkImage.Y + linkImage.Height + 2);
page.Elements.Add(linkImage);
page.Elements.Add(link);
page.Elements.Add(lineObj);
string outputPath = @"C:\Temp\MyLinkDocument.pdf";
document.Draw(outputPath);
Feel free to download a fully functional evaluation edition of DynamicPDF Core Suite for .NET product from NuGet (Package ID: ceTe.DynamicPDF.CoreSuite.NET) or from our website here
.
Thanks,
ceTe Software Support Team