We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add PDF Form Field Action


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");


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;



//clear the settings


//close and save the output document


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.