Free Support Forum -

Hyperlinks are not working in generated PDF Document

I’m using the following code below to populate a text field in a pdf template. When the generated pdf is created the textbox contains the URL but it’s not click-able. I tried setting the “Create links from URL” setting in Preference section of PDF template but that hasn’t worked. Could you please provide an example/documentation that solves this problem. Thank you.

String hyperlink= “”;
Document pdfDocument = new Document(path);
Form pdfForm = pdfDocument.Form;
TextBoxField field = pdfForm[“hyperLinkField”] as TextBoxField;
field.Value = fieldValue;


Thanks for using our products.

Can you please share the source PDF document so that we can test the scenario at our end. We apologize for your inconvenience.


Attached is the pdf template we are using to try and get the URL click-able. Looking forward to your reply. Thanks!


Thanks for sharing the resource file.

I have tested the scenario and as per my observations, I am getting NullReferenceException during form field filling when using Aspose.Pdf for .NET 6.0.0 over Windows XP in VisualStudio 2005 project. For the sake of correction, we have logged this problem as PDFNEWNET-29360 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction.

Can you please share some details regarding your working environment.

I’m using Windows Server 2008 using Visual Studio 2010 C# 4.0.

I’m not getting a NullReferenceException. The pdf is generated. The issue is that the hyperlink is not click-able in the pdf document.

Did you just copy and paste the code I provided above when testing this? That was just sample code and would not work on the template I provided. You would need to update the field name to match the name of the textfield in the pdf document. Just want to make sure.

I’m using Aspose.Pdf for .NET 6.0.0 as well.

Could you provide a code sample that inserts a click-able hyperlink into a pdf document or perhaps some documentation that specifies how to do this?

Is this a limitation with the current release or should I be using a different approach when inserting hyperlinks? Thanks for your time.

Hi, please try the following code: (i.e. add action for the field)

String hyperlink = “”;
Document pdfDocument = new Document(“TestPdf.pdf”);
Form pdfForm = pdfDocument.Form;
TextBoxField field = pdfForm[“hyperLinkField”] as TextBoxField;
field.Value = hyperlink;
GoToURIAction gt = new GoToURIAction(hyperlink);
field.OnActivated = gt;

Also could you please share the result file generated by your previous code ?

The issues you have found earlier (filed as 29360) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.