Free Support Forum -

Add Submit URL button and set JavaScript functions in PDF using Aspose.PDF for .NET

Dear All,

I want to put a “Send Mail” button into a pdf, how to do that?
please help

Thanks & Regards


Please follow the instructions specified over Add Form Field in an Existing PDF file and use FieldType.PushButton to add push button. You may also consider visiting the following links for information on


is it possible to call C# user define function or method when button in a PDF was clicked?
could you please give me an example?

Many thanks in advance


The button in PDF file can only call JavaScript code and I am afraid you cannot directly call some C# code when button inside PDF file is pressed. Nevertheless, I will further discuss this requirement with development team and will keep you posted with the required information. We are sorry for this inconvenience.

Ok, I will wait for your confirmation…



I have further discussed the requirement with development team and I am sorry to share that you cannot call C# code while pressing button inside PDF file. Basically PDF forms can contain JavaScript and XFA forms can also have FormCalc script (see, as per our understanidng, FormCalc is native script language for XML forms).

Your request does not seem to be accomplished and I still wonder why you need to invoke C# code from PDF form?

The fact is that both JavaScript and FormCalc are script languages which serve data in forms. i.e. the kernel of such languages is DOM (PDF fields, annotations etc.) whereas C# is general purpose language and it’s kernel is .NET Platform. Please note that you are not allowed to exceed the limits of PDF document in you script and therefore it’s too hard to support any universal language in the role of script language. Similarly, you can not do anything more with universal language inside PDF form script as compare to performing with simple script language.

As Adobe does not support C# at the moment and we are not entirely certain that if they have any future plans to support this requirement. We are sorry for this inconvenience.