Hello,
Please provide us the assistance to hide button before printing.
Regards,
Shivanna
Hello,
Hi Shivanna,
Thanks for your inquiry. You need to add JavaScript in BeforePrinting and AfterPrinting Actions of Document as following. Please also check documentation link to add JavaScript in PDF document using Aspose.Pdf for details.
Document pdfDocument = new Document("input.pdf");
// To hide field
string beforePrintScript = "this.getField('Button1').display = display.hidden;";
pdfDocument.Actions.BeforePrinting = new JavascriptAction(beforePrintScript);
// To display field
string afterPrintScript = "this.getField('Button1').display = display.visible;";
pdfDocument.Actions.AfterPrinting = new JavascriptAction(afterPrintScript);
Please feel free to contact us for any further assistance.
Best Regards,
Thank you for the help. Its working as expected. But I have started experiencing new problem now. If there are more than one buttons in the PDF form, only the last button is getting suppressed before print, the other buttons ‘beforeprint’ method is not working. Please help us in resolving the issue.
Hi Shivanna,