In this guide you’ll learn how to convert HTML / website content to PDF in SharePoint. This guide is commonly used to convert SharePoint pages such as Wikis, publishing pages, Nintex Forms, and the ‘properties page’ for Lists and Document Library items to PDF. This guide can be used in SharePoint Online or On-premises deployments.
Note: If you are using our PDF Converter before release 8.3, you may find that particularly HTML5 pages (e.g. SP2013 and later) are rendered as bitmaps and ‘overflow CSS’ elements are cut-off. For optimum results please use release 8.3 or higher.
The key HTML to PDF converter features include:
Support for Print and Screen CSS media types to optimize output for Print / PDF Conversion.
Available to all client technology including Nintex Workflow, Nintex Forms, SharePoint Designer, Flow, Logic Apps, REST & Web Services API as well as the SharePoint User interface.
Enabled by default, with the option to switch back to the legacy HTML Converter using our API or config file.
The MSG and EML Converter uses the new engine by default for HTML based emails.
Support for converting SharePoint Online URLs.
Improved error reporting, including authentication related issues.
Modify the ‘View Port’ size to allow responsive web content to output the appropriate version (e.g. mobile or desktop version).
Please keep in mind that HTML is not the best format for print or PDF Conversion purposes. Although our new HTML Converter is much improved, there can still be certain situations where the output is not very well optimized . Depending on your exact needs or system settings you may need to experiment with the various settings.
We recommend you to take into account the following:
When converting MS SharePoint content, it is recommended to disabled the ‘Minimal Download Strategy’ SharePoint Feature as it interrupts the conversion process. Please refer to this article for details. If this is not an option, then set the conversion delay to 1000 (milliseconds).
The Conversion Services will need to authenticate against the page you are looking to convert. The HTML Converter fits in with Windows’ standard security model, so you may need to tweak the server’s internet settings as per this Knowledge Base article. Naturally you have to make sure that the account the Conversion Service runs under has the appropriate privileges to read the page that is being converted.
The converter has no knowledge of the current user’s browser session. If the user has modified the page (e.g. collapsed / opened certain sections) or has made changes to the page without saving, then the converter will not reflect those changes. When converting HTML to PDF, the Converter requests the specified URL from scratch using the credentials of the account the Conversion Service runs under.
If you have any questions or comments, please feel free to contact our friendly support desk.
Setup Automatic PDF Conversion Using SharePoint Designer Workflow
In this example, you will generate a PDF file whenever the Tasks 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 SharePoint Designer.
On the Workflow definition screen, associate the workflow with the Tasks list, tick the boxes next to both ‘Automatically start’ options, and proceed to the next screen.
Add ‘Convert HTML to PDF’ action and click ‘this url’ and enter the URL to the page that was created in the previous step.
Click ‘this file’ and enter the path and file name where the PDF file will be generated, e.g. Shared Documents/Tasks.pdf.
Optionally, change the generated page’s orientation from Portrait to Landscape.
The username and password are optional. By default, the credentials that the Muhimbi Conversion Service runs under will be used to open the web page. You can leave it empty.
Click the Publish button to deploy and activate the workflow.
You can enter one or more tasks to test. You will observe that every time a task is added or updated a PDF file is written to the Shared Documents/Tasks.pdf location. You can open the PDF file to check the results.
In summary, this HTML conversion capability (available in newer versions) opens up many possibilities. As always, upgrades are completely free, so please upgrade and use all the available features.
Convert List Item Including All Attachments to PDF
The PDF Converter for MS SharePoint provides first-class support for converting (and/or merging) files stored in Document or Form Libraries. However, if you want to convert a list item, including all attachments, into a single PDF, then you have to do a little work.
The key to combining the list item and attachments in PDF Converter is the Merge Workflow Activity, which accepts a mix of URLs (to convert the HTML of the List Item View to PDF) and paths to attachments. For example, the following two lines convert the list item and an attachment.
It is pretty simple to generate the fully qualified URL to the List Item, which is just a matter of requesting the current item’s ID and concatenating it to the URL of the list's DispForm.aspx. However, retrieving the URLs to the attachments is a different matter as they all go into a generic 'attachments bin' for which file names cannot be queried from a SharePoint Designer workflow.
You have several options to overcome this challenge of querying the list attachments. Some of these are given below for your reference:
Use Nintex Workflow to extract the attachment paths. Our software ships with Nintex Workflow compatible workflow activities. For more information, refer to How can I use the PDF Converter in combination with Nintex workflow?. For more information on how to retrieve list of attachments, refer to Practical Nintex Forms to PDF Conversion using the PDF Converter for SharePoint (muhimbi.com)
Note: You need version 7.2.1 of the PDF Converter, or newer, to merge List Item attachments.
If none of the above options suit your particular scenario, you can always use our API from your own custom code. For details about merging files from your own code refer to How can I merge files from my own source code? – Muhimbi
Converting HTML pages in MS SharePoint to PDF
When the Muhimbi.PDFConverter.ConvertWebPage.Site feature is enabled on a site collection then an option to convert the current web page to PDF format is automatically added to the Personal Actions menu.
Select this option to convert the current page and download it as a PDF file. This is perfect for quickly saving a list or web page as a PDF file.
The default page size, orientation, margin, scale mode and many other settings can be tweaked in the service’s config file. For details see HTML Specific switches in the Administration Guide, subsection Tuning the Document Conversion Settings.