Adding Hyperlink in TextBoxField

Hi,

I have a predefined PDF template that contains TextBoxField on each row. Please see the attached for reference.

When the user click a button from the application, I’m populating the text in “TextBoxField” in the PDF.

Now, I want to add a hyperlink for some text in the “TextBoxField” which will navigate the user to the URL when they click on the text in the PDF.

Currently I’m populating the text in the formfields using the attached code…

Can you please tell me how to add hyperlink to the text that I’m populating on the PDF using “TextBoxField”??

PDF_FormFields.png (12.7 KB)

Populate_Form_Field.png (18.9 KB)

Thanks

@ddiehl,
You can get the rectangular coordinates of a TextBoxField, and then add a hyperlink to that region of the PDF page. Please try the following code to retrieve the rectangle coordinates:

[VB]

Dim pdfDocument As New Document("C:\Pdf\test249\TextBox.pdf")
Dim textBoxField As TextBoxField = TryCast(pdfDocument.Form("textbox1"), TextBoxField)
Dim rectangle As Aspose.Pdf.Rectangle = textBoxField.Rect

In order to add a hyperlink in the region of PDF page, please refer to this help topic: Add Hyperlink in a PDF File

Best Regards,
Imran Rafique

1 Like

Thanks Imran. It’s working now… :grinning: