Convert a SharePoint Page to PDF

In this guide, you’ll learn how to convert a SharePoint page to PDF using the SharePoint user interface (UI) or by using a SharePoint Designer workflow. This guide can be used in SharePoint Online or on-premises deployments.

The Muhimbi Document Converter for SharePoint supports converting HTML and web content to PDF. This includes converting both SharePoint Online web pages and URLs to PDF. This can be particularly useful when it comes to archiving lists and list items to PDF format or sharing the content of SharePoint pages and wikis with third parties.

Converting Using the MS SharePoint Online User Interface

Although automating conversions is very powerful, sometimes all you need is a quick PDF of the current webpage, which can be generated by clicking a link in MS SharePoint’s UI. You can perform the following steps to set this up:

  1. Elevate the Muhimbi app to allow links to be added to the SharePoint UI. This requires Site Collection Administrator privileges. For more information, please refer to the article on how to elevate app privileges to access advanced features.

  2. Enable the Muhimbi Document Converter - Convert Web Page App Feature. For more information, please refer to information on how to enable advanced features.

  3. Specify the default user credentials for converting SharePoint Online pages. For more information, please refer to the article on online HTML conversion and user credentials.

specify user credentials

user credentials

convert web page app

With everything configured as shown above, you can navigate to a classic view of a MS SharePoint Online page (at the time of writing, this functionality is only available in classic view due to limitations in SharePoint Online’s modern view). From the Personal Actions menu (the menu that opens when clicking on your name in the top-right corner of the screen), select the Convert page to PDF option.

The resulting PDF is automatically optimized for print purposes. The left-hand navigation menu is removed, as are most of the other UI elements. If you prefer the PDF to look exactly like what is displayed in the web browser, including UI elements, then switch to the Screen media type in the HTML Conversion configuration screen (the same screen used for specifying the default credentials).

Converting Using MS SharePoint Designer Workflows

Converting via the SharePoint UI is easy, but often, the conversion is a part of an automated process. For example, every time a list item is updated, or whenever a list item’s status changes to Approved, a PDF file will need to be created and archived or emailed, or any other action will need to be performed based on the business process requirements of your organization.

The easiest way to automate this is by creating a MS SharePoint Designer workflow. You can set this up by performing the steps below:

  1. Install and activate the Muhimbi Document Converter for SharePoint Online Workflow actions. Make sure to use version 9.10 or later.

  2. Although there’s no need to elevate the Muhimbi app or enable the Muhimbi Document Converter - Convert Web Page App Feature, it may come in handy if you don’t wish to store the HTML Conversion credentials inside the workflow itself.

  3. You can specify the default credentials, as well as a number of optional aliases, using Muhimbi’s user credentials facility.

  4. To create a new MS SharePoint Designer workflow, navigate to the list and use SharePoint’s list ribbon to create a workflow in MS SharePoint Designer. A detailed explanation of how to create workflows is beyond the scope of this guide, however, you can refer to a quick video tutorial for help.

  5. Give the workflow a name, set its Start Options (manual in this example), and design the workflow.

  6. Insert the Convert HTML to PDF workflow action and fill in the blanks.

    convert html to pdf

Below is a list of explanations of what’s shown in the image above.

  • this url / html — This is the fully qualified URL to convert. In this example, you’ll convert the list item. Navigate to the View Item URL for the list item, and copy the URL up to and including '?ID=''. This will result in something like https://acme.sharepoint.com/sites/somesite/Lists/some_list/DispForm.aspx?ID=. Select this URL, click the three dots () button, and paste the address. Place the cursor at the end of the URL and click the Add or Change Lookup button. From the Field from source option, select ID to automatically insert the ID of the item being converted.

  • this file — Specify the location to write the PDF file to, e.g. Shared Documents/item.pdf. You can make the file name unique by inserting the ID in the same way as described in the previous step. For details about specifying output paths, refer to this blog post.

  • Orientation — Page orientation of the converted file. Use Portrait or Landscape.

  • Credentials — To convert SharePoint Online webpages — not files, as this applies to URLs only — the HTML Converter needs to authenticate during conversion. Specify credentials, or leave them empty to use the default credentials configured centrally. If one or more aliases have been configured, then they can be used by specifying the alias name between curly braces in the username field (e.g. {SomeAliasName}). The password field can be left empty in this case.

  • Authentication — Accept the default value for URLs located in SharePoint Online. For external — non-SharePoint — URLs, specify web (for normal web-based authentication) or anonymous for sites that require no authentication.

  • Viewport — Optionally specify a virtual screen resolution to allow responsive web content to output the appropriate version (e.g. mobile or desktop version).

  • Media Type — Control if output should be optimized for print layout (using the Print CSS Media type) or rendered exactly as displayed onscreen.

  • Conversion delay — Control the delay between initially loading the page, including JavaScript rendering, and starting the PDF Conversion process. Keep this value high, as SharePoint Online pages contain very rich content.

  1. Finish the workflow, publish it, and start it on a list item of your choice. After a few seconds, you’ll find a PDF rendition in the output folder.

Troubleshooting/Caveats

HTML isn’t the best format for print or PDF conversion purposes. Depending on your exact needs and source material, you may need to experiment with various available settings. If you have any questions or require assistance, please feel free to contact us.

Additional Resources