cancel
Showing results for 
Search instead for 
Did you mean: 

Using Power Automate (Flow) to Convert SharePoint Online Wiki Pages to PDF

Wiki pages are being used widely across organizations because they provide a quick and efficient way to gather large no. of diverse information at a single page which can be shared throughout the organization.

At work, we’re regularly asked by customers of The Muhimbi PDF Converter Services Online, if our PDF Converter can be used to convert SharePoint Online wiki pages to PDF in conjunction with Microsoft Flow, Logic Apps, and PowerApps?  The short answer is yes, and the post below details how you can do it.

For those not familiar with the product, The Muhimbi PDF Converter Online is one of a line of subscription services that converts, merges, watermarks, secures, and OCRs files from Microsoft Flow, Logic Apps, and PowerApps- not to mention your own code using C#, Java, Python, JavaScript, PHP, Ruby and most other modern platforms.

Before we get into the How-TO, let’s review what SharePoint Online wiki Pages are in the first place.

A SharePoint Online wiki is a SharePoint site that is designed for groups of people to quickly access and share ideas by creating simple pages and linking them together. Your organization may use a wiki for a variety of reasons. On a large scale, you can share large volumes of information in an Enterprise wiki that acts as a central database, while also being easy to use for non-technical staff. On a smaller scale, you can use a team site as a wiki to gather and share ideas quickly about a single project.

In his post we’ll show you how to create a Power Automate (Flow) solution to convert a SharePoint Online wiki page to PDF whenever a new wiki page is created or an existing wiki page is modified.

Prerequisites

Before we begin, please make sure the following prerequisites are in place:

Now, on to the details of how to create a Power Automate (Flow) solution to convert SharePoint Online wiki pages to PDF whenever a new wiki page is created or an existing wiki Page is modified.

First let’s review how the basic structure of our Power Automate (Flow) looks :

 

EndtoendFlow.png

 

 

Step 1 – Trigger

  • We use the SharePoint trigger ‘When a file is created or modified in a folder’.
  • Whenever a new wiki page is created, or an existing wiki page is modified, the Power Automate (Flow) will get triggered automatically.
  • For the ‘Site Address’ in the image below, choose the correct site address from the drop down menu.
  • For the ‘Folder Id’ in the image below, select the source folder.

Trigger.png

 

 

Step 2 – Convert HTML to PDF

  • In the ‘Source URL or HTML’ section shown in the image below, paste the Wiki page URL with the following information:
    https://<Sitecollection>/sites/<SiteName>/<NameOfWikiPAgeLibrary>/<FileName>
  • The <FileName> highlighted in the URL above is simply the FileName that we obtained from the dynamic content of the trigger action ‘When a file is created or modified’.
  • In the ‘Page Orientation’ field, select the appropriate option. Depending on the content and layout of the page ‘Landscape’ may work out better.
  • In the ‘Media Type’ field, select the ‘Print’ option from the drop down menu. (This automatically strips out most of the SharePoint User interface).
  • Select ‘SharePoint Online’ as the ‘Authentication type’ from the drop down menu.
  • That being said, you will need to enter the correct ‘User name’ and ‘Password’ to get authenticated with the SharePoint Online authentication that you selected in the authentication field above.
  • In the ‘Conversion Delay’ field, enter a delay of 10000 (in milliseconds, so 10 seconds).  This delay will give the page time to load before it is converted.

pic3.PNG

 

 

Step 3 – Create File

  • For the ‘Site Address’ in the image below, choose the correct site address from the drop down menu.
  • Select the correct ‘Folder Path’ where the converted PDF should be created.
  • Give a meaningful ‘File Name’ to the created PDF, but make sure you remember to add the extension ‘.pdf’ after the ‘File Name’ and to make the file name unique, or multiple runs of the flow will overwrite the same file.  I recommend basing it on the source file name, but with some kind of suffix.
  • Select the ‘Processed file content’ option, shown in the image below, to populate the ‘File Content’ field.

imp.PNG

 

 

That is it, create or update a wiki page, wait a few seconds, and then open the generated PDF.

To see the fruits of our labor, please see below what the Wiki page looks like when viewed in a browser and how it looks as a PDF.

Source Wiki Page –

Untitled.png

 

 

Converted PDF –

Capture.PNG

 

Note – You will notice that the PDF includes some navigation elements. Ideally SharePoint would suppress this information in ‘Print’ mode, but it it doesn’t. We have no control over this unless you want to take the extra step of adding the following CSS to each wiki page:

<style>.ms-core-navigation { DISPLAY: none }#contentBox { margin-left: 0px }</style>

 

Keep checking this blog for exciting new articles about Power Automate, SharePoint Online, Power Apps and document conversion and manipulation.

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Cambridge UK Power Platform User Group Leader, Technical evangelist and speaker. Always says yes to coffee! #LetsGetCoffee
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • I am building business processes and applications that are easy for users' to stick to, so they can follow and understand them. In overall I transform processes to be more reliable and effortless. I am a proud co-organizer of SharePoint Saturday Warsaw and active community member, blogger and international speaker.