Free Support Forum - aspose.com

Add PDF Form Field Action

Hi,

I need event response with data when someone clicks on the PDF form fields which is build with Aspose.

May be I need to set form field action (JavaScriptAction)while someone clicks on the field. When I need to set it?

Here is my Code:

Aspose.Pdf.Kit.Form form = new Aspose.Pdf.Kit.Form(@"../Dependecy\\UB-04_ByRitesh.pdf", @"completed_UB-04_ByRitesh.pdf");

form.FillField("Text2", "This is Test");

form.Save();

FormEditor formEditor = new FormEditor(@"completed_UB-04_ByRitesh.pdf", @"completed_UB-04_ByRitesh11.pdf");

//create a FormFieldFacade to specify visual attributes

FormFieldFacade facade = new FormFieldFacade();

//specify a facade object to the object of FormEditor.

formEditor.Facade = facade;

//add a button field with grey background and beveled border

facade.BackgroudColor = System.Drawing.Color.Red;

facade.BorderColor = System.Drawing.Color.Blue;

formEditor.DecorateField("Text2");

formEditor.DecorateField("MyNameisKhan");

//clear the settings

formEditor.ResetFacade();

//close and save the output document

formEditor.Save();

string uri = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"completed_UB-04_ByRitesh11.pdf";

MyBrowser.Navigate(new Uri(uri));

Hi Ritesh,

Are you interested to add JavaScript to a button control or the text field? As Aspose.Pdf.Kit currently allows to add JavaScript to a button field or at the document level only; you can find the details on this link. If this is not something you’re looking for then could you please elaborate your requirement a little bit?

We’re sorry for the inconvenience and looking forward to help you out.
Regards,