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

Free Support Forum - aspose.com

Adding Javascript to Push Button

Hi Team,

Im trying to add a push button into a PDF and then adding javascript to the push button field which open the print pop up on click. But the javascript is not working.

The code which i tried:

Aspose.Pdf.Document d = new Aspose.Pdf.Document(app_path + "Popup.pdf");


FormEditor frm = new Aspose.Pdf.Facades.FormEditor(d);


FieldType.PushButton, "Print", "Printing", 1, 200, 700, 300, 725);


"Print", Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationFlags.Print);


"Print", "window.print();");


Also find attached the PDF on which i applied this field and javascipt. Kindly help me on this issue.

Hi Santosh,

Thanks for your inquiry. Please use following script instead “window.print()”, it will resolve the issue.

frm.SetFieldScript(“Print”,“var pp = this.getPrintParams()

Please feel free to contact us for any further assistance.

Best Regards,

Thanks team, I also have another request. How to bind ajax calls script to the same push button field. I tried the following code







"application/json; charset=utf-8",



success: OnSuccess,


function (response) {

/*some text*/



function (response) {

/*some text*/}


But this is not working. Kindly help us on how to make ajax calls from push button field click

Hi Santosh,

Thanks for your inquiry. We are looking into your requirements and will get back to you soon.

Best Regards,

Hi Santosh,

Thanks for your inquiry. I am afraid the ajax script is not supported at the moment. So we have logged a new feature request for same as PDFNEWNET-37965 in our issue tracking system for further investigation and implementation. We will notify you as soon as we implement it.

We are sorry for the inconvenience caused.

Best Regards,