I am creating a PDF within a .NET c# application.
Right now, I have found examples of alerting out text on opening the PDF (after i saver it locally) by using:
document.JavaScripts.Add(new DocumentJavaScript("Say Hi", "app.alert(\"Hello!!\")"));
Is there a way, to use the java script to load a URL when the PDF opens?
Thanks,
ceTe Dynamic PDF DocumentJavaScript
Re: ceTe Dynamic PDF DocumentJavaScript
Support · May 26, 2017Hello,
Yes, you can load a URL when a PDF document loads in the PDF viewer/Reader. You will need to add the document level JavaScript to the Document using DynamicPDF API. Below is the code sample.
Document document = new Document();
Page page = new Page(PageSize.Letter);
document.Pages.Add(page);
document.JavaScripts.Add(new DocumentJavaScript("URL", "app.launchURL(\"http://www.google.com\", true);"));
document.Draw(@"E:\Temp\test.pdf");
Thanks,
ceTe Software Support Team.