Image with underline and hyperlink

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v11)  /  Image with underline and hyperlink

DynamicPDF CoreSuite for .NET (v11) Forum

 Jun 10 2021 8:29 AM
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
Posted by a ceTe Software moderator
Hello,

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

All times are US Eastern Standard time. The time now is 4:13 PM.