Hello,
I am generating a PDF File using dynamic PDF in .Net.
I would like to be able to display a link (like a hypertext link) that will bring me to a define X,Y of the same PDF File.
I found the bookmark outline but I need the link to be in the page.
Anyone has any idea ?
Thank you.
Guillaume
hypertext link to a location in the pdf document
Re: hypertext link to a location in the pdf document
Support · Dec 19, 2011Hello Guillaume,
Yes, you can achieve your requirements without any problem using our DynamicPDF Generator for .NET product. You will need to use Link page element to do this. You can use XYDestination class to set the desired action to the link by specifying the page number, X and Y locations on the page where in you want to navigate. Please refer documentation on Link page element at: http://www.DynamicPDF.com/Support/NET_Help_Library_11_11/ceTe.DynamicPDF~ceTe.DynamicPDF.PageElements.Link.html
. Also refer the documentation on XYDestination class at: http://www.DynamicPDF.com/Support/NET_Help_Library_11_11/ceTe.DynamicPDF~ceTe.DynamicPDF.XYDestination~_ctor.html
. Below is the sample code for it.
Document document = new Document();
PageDimensions dimensions = new PageDimensions(1000, 1000);
Page page1 = new Page(dimensions);
document.Pages.Add(page1);
XYDestination dest = new XYDestination(1, 700, 700);
Link lnk = new Link(0, 0, 150, 30, dest);
Label label = new Label("Click here to go to destination", 0, 0, 150, 30);
label.TextColor = RgbColor.Blue;
Label label1 = new Label("Destination", 700, 700, 150, 30);
page1.Elements.Add(label);
page1.Elements.Add(lnk);
page1.Elements.Add(label1);
document.Draw(@"C:\MyDocument.pdf");
Thanks,
ceTe Software Support Team.
Re: hypertext link to a location in the pdf document
Forum member · Dec 19, 2011Thank you for your quick answer. It does exactly what I needed.