In this guide, you’ll learn how to convert a SharePoint wiki page to PDF using Power Automate and Muhimbi PDF Converter. This flow is triggered when a wiki page is created in the Site Pages folder, where it gets converted to PDF and written to a different MS SharePoint location. Our flow actions also support the conversion of MS SharePoint Online pages.
Steps to convert your wiki to PDF using Power Automate:
- Create a flow in Power Automate
- Define your action
- Create a file
- Publish your workflow
This example uses Power Automate to convert a SharePoint wiki page to PDF in SharePoint. However, you can save your converted PDF file to another destination, like Dropbox, Google Drive, OneDrive, or any platform supported by Power Automate. You can also extend our example by adding additional automation, such as sending the converted PDF as an email.
From a high-level perspective, the workflow will look as shown in the image below.
1: Creating a New Flow
Create a new flow and use the When a file is created in a folder trigger for SharePoint Online. Fill out the URL for the site address and select the relevant folder.
2: Converting HTML to PDF
Insert Muhimbi’s Convert HTML to PDF action and fill it out as shown in the screenshot displayed below. You’ll need to substitute the Source URL or HTML field with x-ms-file-path-encoded, which is the output of the When a file is created in a folder action. In the advanced options section, fill in the appropriate user name and password.
3: Creating a File
Insert a Create file action to write the converted file back to SharePoint Online. In the Site Address and Folder Path fields, fill in the appropriate information. In the File Name field, select Base file name.pdf, which is the output of the Convert HTML to PDF action. In the File Content field, select Processed file content, which is the output of the Convert HTML to PDF action.
4: Publishing the Workflow
Publish the workflow and create a wiki page in the site pages folder. After a few seconds, the flow will trigger and a PDF file of the wiki page will be generated.
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.
Please consider the following when using Power Automate:
Modern views — In SharePoint Online, it’s possible to display lists and libraries in modern or classic mode. Modern view is undergoing constant change (by Microsoft), and some modern view pages will convert fine, while others don’t. As a result, we currently only support the conversion of pages displayed in classic view.
Multi-factor authentication (MFA) — An increasing number of SharePoint Online/Office 365 environments are secured using MFA. Although this is a positive development, it gets in the way of automated systems, including our HTML converter. If your environment uses MFA, create an app password for HTML conversions, or disable MFA on your HTML conversion account.
HTML conversion option isn’t displayed — The option to convert the current page to PDF is only available in classic SharePoint pages. Modern pages currently don’t provide the ability to extend the personal actions menu. As soon as Microsoft makes this functionality available, we’ll add it.
PDF layout doesn’t match — By default, the page being converted is optimized for print/PDF output. If you prefer for a PDF to look exactly like what’s displayed onscreen, including user interface elements, set the Media Type to Screen in the HTML conversion configuration screen.
User-modified content isn’t converted — The converter doesn’t have knowledge about the information currently displayed in the user’s browser (e.g. size of the browser window, or custom data entered but not yet submitted to the server). The converter always requests a fresh copy of the URL and converts that information to PDF.
User-specific information is missing — HTML conversion is carried out in the context of the configured user account, though the system isn’t aware of the user carrying out the HTML conversion. Don’t specify accounts that display more information than what users need to have access to.
For more information, refer to the following resources.