Hi all,
Hi,
Thank you for using our product.
This can be achieved using the script on a form field to hide / unhide a textbox field but currently Aspose.Pdf for .NET does not support to add script to a checkbox field. I have created a new feature request in our issue tracking system with issue id: PDFNEWNET-34248. Our development team will further look into the details of this feature and we will keep you undated regarding any progress.
However, Aspose.Pdf for .NET does support adding the script to Push Buttons. Please see the following documentation link and see if you can utilize this feature to acquire your desired results.
Set JavaScript for Push Button (Facades)
Also, you may check the following code with script to hide / unhide using button field:
//create FormEditor object
FormEditor formEditor = new FormEditor();
formEditor.BindPdf(@"D:\AP Data\September2012\HelloWorld.pdf");
//set JavaScript
formEditor.SetFieldScript("Button1", "var field = this.getField('Text2');
if(field.display == display.visible) field.display = display.hidden;else field.display = display.visible;");
//save update document
formEditor.Save(@"D:\AP Data\September2012\HelloWorld_out.pdf");
Sorry for the inconvenience,
Hi Tri Dung,
FormEditor formEditor = new
FormEditor();<o:p></o:p>
formEditor.BindPdf("d:/pdftest/HelloWorld (1).pdf");
//set JavaScript
formEditor.SetFieldScript("CB1", "this.getField('CB1').display = display.hidden;");
//set JavaScript
formEditor.SetFieldScript("bt1", "this.getField('bt1').display = display.hidden;");
//save update document
formEditor.Save("d:/pdftest/CheckBox_javaScript_34248.pdf");