Nintex Online for Office 365 Form: How to customize Print to PDF functionality using JavaScript

In Nintex Online for Office 365, the Print to PDF button is available in ribbon. But if you want to implement the same functionally in your custom JavaScript button then follow below steps.


Step 1: 
Add a button, Set the property

  • Button Action: JavaScript
  • Button Type: Button
  • Button Lebel: Print to PDF
  • Cause Validation: No
  • Client Click: printToPDF();
Step 2:
Go to Ribbon- Designer- Form Settings-Custom JavaScript and add below code

function printToPDF(){ 
 NF.PrintToPDF(window).Print();
 return false;
}
Click Save - Publish the Form
By default, it will print the whole form. But if you want to hide certain elements on PDF, at first hide using jQuery and then call NF.PrintToPDF(window).Print() function, like

function printToPDF(){ 
 NWF$('.menuButton').hide(); 
 NF.PrintToPDF(window).Print();
 NWF$('.menuButton').show(); 
 return false;
}

:-)