Without having Nintex Forms Enterprise and the handy "Print to PDF" functionality, we often spend a lot of time on workarounds for this. My good friend and colleague Gary Powell-Jones came up with this solution that he has allowed me to share with you all:
Print friendly Nintex Forms
Designing the form
The form can be designed to allow items to not be printed (e.g. appear only on screen) or appear only when printed (such as a disclaimer).
For print only items, add a css class of printonly to the control or element
For no print items, add a css class of noprint to the control or element
Note that the JavaScript below will work even if there are no controls or elements with these css classes
Form custom JavaScript
Include the following snippet in the form custom Javascript. It adds a function called ‘PrintFormHtml’ to print the form, a function to hide print only elements when the form is initially loaded.
function PrintFormHtml(){
NWF$('#suiteBar').hide();
NWF$('.noprint').hide();
NWF$('printonly').show();
window.print();
NWF$('#suiteBar').show();
NWF$('.printonly').hide();
NWF$('.noprint').show();
return true;
}
NWF.FormFiller.Events.RegisterAfterReady(function () {
NWF$(document).ready(function () {
NWF$('.printonly').css('display','none'); //THIS HIDES PRINT ONLY ELEMENTS
});
});
Print Button
Add a button to the form, using the JavaScript action. The action will be PrintFormHtml();. Optionally, the button can be made visible on the SharePoint ribbon using the standard Nintex settings
Operation
When the button is clicked it
- hides the suitebar
- hides items with the CSS class of ‘noprint’
- shows items with the CSS class of ‘printonly’
- calls the printer dialog
After printing, it resets the form:
- showing the suite bar
- hiding the print only elements
- showing the no print items