Printing SharePoint forms and exporting to PDF

In this blog post I will describe two new features that Forms Designer has received in the 3.0.7 release. You now have the ability to save your forms to PDF files (without help of a virtual printer) and print them in a printer-friendly way.

You can add the print and export buttons via General Settings in Forms Designer:

This will give you two additional buttons in the ribbon:

Printing

Suppose you have a form like this one:

As you can see, the form utilizes an accordion control that hides part of the form.

Now, when I click ‘Print’, the following document is produced:

As you can see, the document contains just the form without all the extra bits present on the webpage, plus the accordion is expanded, so all of the information is shown in the document.

Note, you can arbitrarily hide UI elements in print mode if you add ‘fd-no-print’ CSS class to them.

Saving to PDF

You now also have the ability to save PDF versions of your forms via Export to PDF button. Here’s what happens if we use it with our form:

The resulting PDF document contains the form as it is shown on the webpage.

Doing the above programmatically

You don’t have to add the ribbon buttons to use this functionality. You can use the following functions instead:

  • fd.saveAsPDF(‘invoice.pdf’) – this will save the form as a PDF with the name ‘invoice.pdf’
  • fd.printForm() – this will print the form

You can use these functions with your own Print/Export buttons or in some other way.

Recommend this: