In this guide you’ll learn how to convert HTML fragments or web pages to PDF using a SharePoint Designer Workflow. In this specific example we show you how to convert a SharePoint list to a PDF format but this workflow can be used to convert any Web Page to a PDF File. This guide can be used in SharePoint Online or On-premises deployments.
One additional consideration when converting a list to PDF is whether to display the SharePoint UI in your document once it has been converted. If you prefer converting your list to a PDF without the quick launch menu start we've outlined steps to follow below.
Creating MS SharePoint Pages Without Quick Launch
To create a new page without the Quick Launch menu follow these steps:
Navigate to the All Site Content screen and click gear icon and click Add a page.
Enter the Title and add a List Web Part, and add a List - Expense Report
On the newly created page click Add a Web Part and add the Expense Report List.
Before adding the list in the page, please ensure you select the columns you want to be included in the PDF file by navigating to the List Settings in the List. For example Title, Expense Details, Attachments, Created and Created By..
Under the Item Limit section set the limit to an appropriately large number. We don’t want to page through the data in batches as we want to include all items in the PDF file.
Click Save button to save the changes and Publish button to publish your changes.
Save the page’s URL as we need it later. E.g.
This new page will be used as the underlying layout of the PDF document. Feel free to modify it further in SharePoint designer / JQuery and remove more parts of the SharePoint user interface. You could also consider creating a minimalistic master page and applying that to the new PDFTasks page.
Creating Automatic Conversion in MS SharePoint Designer
With the page in place the next thing we need to do is set up the automatic PDF Conversion using a SharePoint Designer workflow. In this example we generate a PDF file whenever the Expense Report List is modified. The generated PDF file is stored in the Shared Documents library. You can create the workflow as follows:
Make sure you have the appropriate privileges to create workflows on a site collection.
Create a new workflow using MS SharePoint Designer.
On the Workflow definition screen, associate the workflow with the Expenses Report List, and tick the boxes next to both ‘Automatically start….’ options and proceed to the next screen.
Add the Convert HTML to PDF action and click “this url” and enter the URL to the page that was created in a previous step, e.g.
Click “this file” and enter the path and file name where the PDF file will be generated, e.g. Shared Documents/Expenses.pdf.
Optionally, change the generated page’s orientation from “Portrait” to “Landscape”.
The username and passwords are optional. By default, the credentials the Muhimbi Conversion Service runs under will be used to open the web page. For now, leave it empty.
Click Publish button to activate the workflow.
As a test, enter one or more items in the List. Every time an item is added or updated a PDF file is generated and written to Shared Documents/Expenses.pdf. You can access and open the PDF file to see the results.
In summary, the HTML conversion capability of the new version opens up a whole array of new possibilities. As always, upgrades are completely free, and please feel free to upgrade your converter to the latest version to enjoy all the conversion features.