cancel
Showing results for 
Search instead for 
Did you mean: 
yashkamdar

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.

About the Author
  • 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.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/