{"id":110985,"date":"2018-11-14T05:30:19","date_gmt":"2018-11-14T13:30:19","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/convert-pdf-with-microsoft-flow-nov-2018\/"},"modified":"2025-06-11T08:06:09","modified_gmt":"2025-06-11T15:06:09","slug":"convert-pdf-with-microsoft-flow-nov-2018","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/convert-pdf-with-microsoft-flow-nov-2018\/","title":{"rendered":"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow"},"content":{"rendered":"<p>Whats up Flow Fans!\u00a0<\/p>\n<p>This week we have a special FOTW From one of our MVP&#8217;s &#8211; Paul Culmsee!<\/p>\n<p>Paul Culmsee (<a class=\"twitter-atreply pretty-link js-nav\" data-mentioned-user-id=\"16920900\" dir=\"ltr\" href=\"https:\/\/twitter.com\/paulculmsee\" style=\"background: none 0% 0% \/ auto repeat scroll padding-box border-box transparent; color: rgb(28, 148, 224); font-size: 14px; font-style: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: 400; white-space: pre-wrap;\">@paulculmsee<\/a>) is a management and technology consultant, Microsoft MVP and award winning author from Perth, Western Australia. He co-founded Seven Sigma Business Solutions (<a class=\"twitter-timeline-link\" data-expanded-url=\"http:\/\/www.sevensigma.com.au\" dir=\"ltr\" href=\"https:\/\/t.co\/1gocPaN1Tw\" rel=\"nofollow noopener\" style=\"background: none 0% 0% \/ auto repeat scroll padding-box border-box transparent; color: rgb(28, 148, 224); font-size: 14px; font-style: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: 400; white-space: pre-wrap;\" target=\"_blank\" title=\"http:\/\/www.sevensigma.com.au\">http:\/\/www.sevensigma.com.au\u00a0<\/a>) and specialises in sensemaking, helping organisations (re)discover their purpose, knowledge management, strategic planning, IT governance, facilitation and all facets of SharePoint and Office365 delivery<\/p>\n<h2>\u00a0<\/h2>\n<h2><strong>Sympathy for the on-site technician<\/strong><\/h2>\n<p>Hi everyone.<\/p>\n<p>Imagine a company where service technicians perform on-site repair of equipment. Inevitably, in doing this sort of work, the technician will need to refer to equipment drawings, service history, past photos, specifications and\/or operating manuals.<\/p>\n<p>These days PowerApps is fast-becoming a great option for such a scenario because many field workers prefer to use their phone or a tablet. I have made many apps like this and PowerApps is a great solution for this use-case. But PowerApps also has some limitations, and right now that is around the display of documents from SharePoint. For a start, it is impossible to display office documents natively in PowerApps at this time, and there are authentication-related issues in certain circumstances when pulling content from SharePoint.<\/p>\n<p>But fear not\u2026 with a 6-step flow, it is possible to solve this problem. This flow allows a remote user to securely request a document from SharePoint, but importantly, <em>converts that document to a PDF on the fly<\/em>.<\/p>\n<p>There are two big benefits from this:<\/p>\n<ol>\n<li>A reduction in time and effort for document controllers. If a document frequently changes, it is most likely in word, excel or PowerPoint format. They do not have to worry about converting it to PDF.<\/li>\n<li>It allows the document to be viewed in PowerApps natively (As a result of #2, on top of some Flow kung-fu, we will learn some PowerApp tricks in this article too :-).<\/li>\n<\/ol>\n<p>Now in the (admittedly large article to follow, I go into detail on how to set this up, but if you prefer to see this in video form, we also have you covered\u2026<\/p>\n<p><iframe loading=\"lazy\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\" height=\"315\" src=\"https:\/\/www.youtube-nocookie.com\/embed\/zTyqEEc9-FI\" width=\"560\"><\/iframe><\/p>\n<h3><strong>Step 1: Setting up a SharePoint library<\/strong><\/h3>\n<p>Since this is a field-worker scenario, let\u2019s make a SharePoint library and be good digital citizens by throwing in an extra couple of columns so we can tag documents by their type. I\u2019ll keep it deliberately simple for the purpose of this post, but you can extend this type of library setup in whatever manner suits you.<\/p>\n<p>I created a new SharePoint site, and added the following columns to the default document library:<\/p>\n<ul>\n<li><strong>Equipment<\/strong> \u2013 Single Line of text<\/li>\n<li><strong>DocumentType<\/strong> \u2013 Single Line of text<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"290\" src=\"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none\" width=\"1467\"\/><\/p>\n<p>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"751\" src=\"https:\/\/rh9t6w.dm.files.1drv.com\/y4mZuoayC548s3VoDI4SDGxiQ1tZnajawpKKrsQbzaaZsEXfPtfaOg34k3Kdj69GkluJtK3K6kXXlcFc7vKU47882xsjIBdw-KAuKo-l1SgKq75101o5xUa77bglgPJeBbtH77XWdFY4urfidw1ic3JXO-MaAaFNwQNUcgySdppvt087cJB-aaAliM6U5LKTufkMaXalX6GRNTZ8kbcVu5w-w?width=435&amp;height=751&amp;cropmode=none\" width=\"435\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"736\" src=\"https:\/\/4zmujg.dm.files.1drv.com\/y4mu_1tIqNL3w8c-_R-iAVG0KVGgkwklkPO1sWA_HVbRw-JOGhJsXPw8JMi7zMc8mIvdPuiyHopg98LlRGupaPTxgPohP0k6NTJmeFhHfLiJOlQ2SsujOrRAyKkjOsuKXr9Mm4eSknVALDTsPpIn6DXEXQsb9xRce5wWETEm9cmlVTT5osRk08q3v0fR-8wTe5FZtDV2IHbEFclSH1DFMRo6A?width=418&amp;height=736&amp;cropmode=none\" width=\"418\"\/><\/p>\n<p>Now upload some documents and tag them by type and by equipment. In the diagram below, take note that I\u2019ve also thrown in a folder with some documents inside. While I won\u2019t win any information architecture awards for doing this, it is very much the reality for many organisations and it demonstrates that the flow we will build accommodates complex folder structures also.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"518\" src=\"https:\/\/twayga.dm.files.1drv.com\/y4mOnFeJkq5KQehTTYiOiPU7iEa3vJRz1wLVFGMQbN78T0tvOARmagwsytcY-HcmRnSXzaSkBB9xW9IAkeHg1k88oMNFPLYYpXjkWpb9BEBDlCODSeUxSN5cnGv_iu4RvoRHi-A_-mag8Nw-T7IxaSabpAAqeoDaUogCx9jzxcTAV4i-kmdJdHMEkDphxYVRdv6o7cqrkamYgPC5aMifFBeZw?width=1337&amp;height=518&amp;cropmode=none\" width=\"1337\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Oh\u2026 also keep the documents relatively simple. I can\u2019t guarantee this auto-pdf goodness works with crazy large documents or those with embedded bits and pieces.<\/p>\n<h2><strong>Building the Flow<\/strong><\/h2>\n<p>The flow we are going to build is going to be triggered from PowerApps. PowerApps will pass in the ID and folder path of a particular file, and the flow will do a small bit of data cleansing before using a very powerful action called <strong>Send an HTTP request to SharePoint<\/strong> to bring it back as a PDF.<\/p>\n<p>Please note this flow is deceptively simple as it only requires as little as 5 actions, but we are using some nice trickery so take your time\u2026<\/p>\n<h3><strong>Step 1: Create a new Blank Flow, and choose the PowerApps trigger<\/strong><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"779\" src=\"https:\/\/svekdg.dm.files.1drv.com\/y4mGXHKWeg1XyYOYrw_f3FMauHIA0jtfM_y7OTrPiP4rNF6NLa2QI17DemWj08vELcBuNCvNuFL7-qebvcwarWb4mWW6zS7Hv8zh05MCIHNzzZb5Y3DAO0GUcndoY7ISBMGArANcX5gLs7OC7LgBiBBpZry18uQWkf1f1nl6cVZ_evP7I2B3PBfxzzDRreqzg4_S9jJqIWKRXbcZBpjsabaMw?width=1000&amp;height=779&amp;cropmode=none\" width=\"1000\"\/><\/p>\n<h3><strong>Step 2: Add an Initialize Variable Action.<\/strong><\/h3>\n<p>This variable will hold the ID of the file sent from PowerApps. For reasons that will become apparent later, rename this action to <strong>FileID<\/strong>, add a variable called <strong>ID<\/strong>, make it <strong>String <\/strong>format.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"489\" src=\"https:\/\/0wwkmw.dm.files.1drv.com\/y4miCb9MPf5mBmPpw2k8TTCcYtCPINb8Dt8X3zEvBYElTz8uMaGcbj6g4mvD4BISojd9bJRoGrTfNBdpujbAvZcE-g7KzwI9hRNAq3z7tzjXUGrMl0tETlV7Mp5zOJ3ozM9PYKptLc2Bqepyi0pJuWQzOvFdIwgZDofXyqrQ5GayYFe9d2p2t0k__1tJmfveeEVczCbR_i8km0SBflAPw4juA?width=1391&amp;height=489&amp;cropmode=none\" width=\"1391\"\/><\/p>\n<p>For the Value, click <strong>Ask in PowerApps<\/strong> from the Dynamic Content panel (click <strong>see more<\/strong> if this is missing)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"411\" src=\"https:\/\/ojhika.dm.files.1drv.com\/y4mlwTXQBaM7F0fmlP-4n2fpt17ENUwQYLoqCxStbkTDSjMQtSyotKlUYvTI8hjXIJ-JxTemsPAiJwiFBc8QdCba7mICpUnbQzn87Yr5K3e64DtvaQQevlSypU5LJoLIxT3tTpAFpJYAEERUl-Mjkcfl6qGQwM1lb1MxYvFW0q9a9rhlSf4h4ZeVNpxNcsf9ECFrXfTjTdrDrsJVaWy-4tPqw?width=1419&amp;height=411&amp;cropmode=none\" width=\"1419\"\/><\/p>\n<p>If you do this right, you will see a <strong>FileID_Value<\/strong> parameter name in the textbox. Now when we invoke this flow from PowerApps, this is the name of the parameter that the user will see. Eg:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"93\" src=\"https:\/\/q6resa.dm.files.1drv.com\/y4m8kwC2L3MQaMwL4ozKGlBJx9kyAC9U2ngLakanuXmaoShY6KO94C40nBoTxwBrGW4y11InJd5nx-OQtqPfPx5Ngzj9oiUbkhVdjHfliXpWyCo60_JyDSa93wReidwND7BhyEe9iNP2cCbUFK9Uaac6FwGTBGgUifjL--j68Kcs9IFg1D1olCDw7ICnURt4f7x4LfbVr6LgcWPxBu66zld2Q?width=423&amp;height=93&amp;cropmode=none\" width=\"423\"\/><\/p>\n<p>Why is this? Well, behind the scenes, PowerApps used the <em>name of the action<\/em> to generate this parameter name, hence why it made sense to rename it something simple so you don\u2019t make the PowerApps view confusing.<\/p>\n<p><em>Note: I tend to add comments to my flow actions to make the intention clear as shown below.<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"247\" src=\"https:\/\/rh9s6w.dm.files.1drv.com\/y4mJ-7BMW3R4wjfVF-zXIMZOUCDBD2xjdQJ9d0D4Fd5nj1_eCPd0aWN9ptR3oGS1I_3vjm6-DXcMiD1tuoW8SxAksO20_LDkfX8qXZvWQzoMAw5WTAfm8m5iYJ9oVbNbsT0osDRCR5gyxLGsVDVezARYWaO-wCWHKYzHeKZcYAHfFe8OEtanrdc-VADlKkIng80jiAXOul977FnitU08piMjQ?width=617&amp;height=247&amp;cropmode=none\" width=\"617\"\/><\/p>\n<p>\u00a0<\/p>\n<h3><strong>Step 3: Add another Initialize Variable Action.<\/strong><\/h3>\n<p>This variable will hold the folder path of the file and will also be sent from PowerApps. Rename this action to <strong>FolderPath<\/strong>, add a variable of the same name. This time make it a string and once, again use \u201cAsk In PowerApps\u201d to set a parameter called \u201cFolderPath_Value\u201d as shown below\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"214\" src=\"https:\/\/edydpg.dm.files.1drv.com\/y4mpekYL1loUr440fI4MGx4l9AnhDW2bAkdBcM7AGtN0I9o8dBMoLCoTwxpB8tNgJpVFpMk2n3UFIL2D_ucRMbIgpgv7jL3tnVUT2B0OcqD5-LXEr2mCklieY8wJC0CVPZGy3_prKLKm8VSKLZauCCWKMxvCx50Ic0vLi0jg0XSsvmQDJnHRA0oIhpegH2ktMv2MVCKEdTwrwWWAJ5DAiYF8g?width=634&amp;height=214&amp;cropmode=none\" width=\"634\"\/><\/p>\n<h3><strong>Step 3a. Sanity check interlude!<\/strong><\/h3>\n<p>Please note this common trap for new players\u2026 if you clicked <strong>Ask in PowerApps<\/strong> more than once, then you might have some additional unwelcome parameters. I recommend being really (really) careful here to ensure you only have two parameters defined, otherwise it will make working with PowerApps a bit of a pain later. So, check that in <strong>Dynamic content<\/strong>, you only see the two parameters as shown below\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"855\" src=\"https:\/\/4zmtjg.dm.files.1drv.com\/y4mEDKVNbnUabud3eAmOjod_CwI-H1TCbzXtN3bDSv_2i4-ORnrDLrrVQhziTmFTfk_URpjurL3fvDe6a7Kdz30Fv1MoRk16dN5Q6P5nsTY-A5mavhvvZ9MC3CJPP3eLjcvIq_EDYhIJvOlG3sisOGE9Re9-XGFR6lR18Bdmis0sz73kxsPtefTXUK9R9Z4ViQOlEpMy-qk12M-WfyNnAQLUg?width=1281&amp;height=855&amp;cropmode=none\" width=\"1281\"\/><\/p>\n<h3><strong>Step 4: Clean up the data.<\/strong><\/h3>\n<p>A common occurrence in the world of messing with low-level stuff is that data is not always in the format we need it to be. In this case, it turns out that when PowerApps sends the folder path to Flow, it will send it in this format.<\/p>\n<p><strong>DocumentLibraryName\/Folder\/<\/strong><\/p>\n<p>Unfortunately, when we send this to SharePoint to get the PDF URL, it needs to be in a format that includes the site collection URL and the removal of the trailing slash.<\/p>\n<p><strong>\/Sites\/SiteName\/DocumentLibraryName\/Folder<\/strong><\/p>\n<p>Adding the site collection URL is easy \u2013 and we will do that later. But the trailing slash needs a flow expression to strip the trailing slash from the path. The expression will look like this:<\/p>\n<p><strong>substring(&lt;path&gt;,0,sub(length(&lt;path&gt;),1))<\/strong><\/p>\n<p><em>If you are new to <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/logic-apps\/logic-apps-workflow-definition-language\">Flow expressions<\/a>, then yes \u2013 I agree that they are ugly. But trust me, they do become quite intuitive over time and actually can really bring your flows to life. For the record, what we are doing here is using a substring function to grab all except the final character of FolderPath variable. To exclude the final character, I take the length of FolderPath and subtract it by 1.<\/em><\/p>\n<p>Now we <em>could<\/em> sort this out by adding another initialize variable action to reformat the path in the way we want it. But that means an extra step and variable. So, let\u2019s be cool and <em>modify the previous step<\/em> to do it in one hit. So, go back to your <strong>FolderPath<\/strong> action and delete the <strong>FolderPath_Value<\/strong> reference in the <strong>Value<\/strong> textbox.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"332\" src=\"https:\/\/f31i0w.dm.files.1drv.com\/y4mXaDzUIM5i6JzgDL7pPEVqigXfN3rZ9Y3-9HVDwu4HTqUT1uRmgsThA_8es8k8vbH0-hXtKAB6eRz8El3U90QHdmku6-svxoVOkjb3XodSMn2hM8JiYCLZOXgiTqINzhOoUDU2e58StitPkRhk_dqJmEEDg31MbZDoWdXAMPW5K7ljYaR7Pg-wLBb-Yf2_cmPzLi4g6epTMOAkeuF24ogcQ?width=1327&amp;height=332&amp;cropmode=none\" width=\"1327\"\/><\/p>\n<p>Now click <strong>Expression<\/strong> in the <strong>Dynamic content<\/strong> panel and check out this little-known trick. Type in the word <strong>substring( <\/strong>and you will see a somewhat annoying pop-up like so\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"305\" src=\"https:\/\/fai7ma.dm.files.1drv.com\/y4mowMuW7TeEg_rkVya34Rfi5O3Ujizjn1suvHFgsmoDtFRZdI1HNufMILtZxo9fT0Kw8vG78li2wLLAdB3_LjG5yeXxCSwzRArucSFknhCSyw_mpA15_FZcrRWyyYfrVTM6nxkp3xPs0X8ZPWJXMbMDd-0f2ouV8GKZQ6j3hcMz3IIcO6K80YdO6oYpsON1i5TV_VqBpTUDC8iB92DuP-5vg?width=411&amp;height=305&amp;cropmode=none\" width=\"411\"\/><\/p>\n<p>Now, make sure your cursor position <em>is in between the two brackets after the word substring<\/em>! Then click the <strong>Dynamic Content<\/strong> tab, and you can now choose the <strong>FolderPath<\/strong> parameter. It will add it into your expression. Neat huh?<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"792\" src=\"https:\/\/twaxga.dm.files.1drv.com\/y4mnxTWo1DR0PoZbEJmkt9h4NjvBrTVZQIhZiZioLii9YkuOP7AShAXRo62kme7hs2c6zpeSF4RC-2STg288ZeqyL2bDbz7Ng3FyT6u0J-9_bpL6WR2FxlT6z9zn8NTFJPQdAJeVV6riRrRUt9Pa3bujlIqY9iJoMQdOsmnX5QOcA0KUeXALqPtFEDDk_79YHr_doIF3hvyBNqX9ORqSetUUA?width=621&amp;height=792&amp;cropmode=none\" width=\"621\"\/><\/p>\n<p>Now your expression will look like the following:<\/p>\n<p><strong>substring(triggerBody()[&#8216;FolderPath_Value&#8217;])<\/strong><\/p>\n<p>\u00a0<\/p>\n<p>This neat trick allows you to write flow expressions and refer to variables or parameters without manually having to type them in. Now all we need to do is fill out the rest of the expression using this reference to the <strong>FilePath<\/strong> parameter.<\/p>\n<p>From:<strong> <\/strong><strong>substring(&lt;path&gt;,0,sub(length(&lt;path&gt;),1))<\/strong><strong> <\/strong>we replace <strong>&lt;path&gt;<\/strong> with <strong>triggerBody()[&#8216;FolderPath_Value&#8217;]<\/strong>:<\/p>\n<p>\u00a0<\/p>\n<p><strong>substring(triggerBody()[&#8216;FolderPath_Value&#8217;],0,sub(length(triggerBody()[&#8216;FolderPath_Value&#8217;]),1))<\/strong><\/p>\n<p>Your flow action will now look like the screenshot below\u2026 note that I completed this task by adding the above expression to the comment for the action to make it clear what is going on\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"231\" src=\"https:\/\/svejdg.dm.files.1drv.com\/y4mCbwAkbj-3ncTWypmbmjmceIeua2vrsyxt4ZZV8iPef6ItiOtWoueGtnsRKZKUWpgD1x8IdS5ZZJlpknLcPj6E2EJNvr19l8-hF2QgtHlokEzIqwuUiM1k0I5qKraRUKNgImBoIohF50NmfUsRrYQ1Edkhm65XplBPxsIQ_9kL_s91At0p3fs7Wlx6PBfIAccEPS0z3Lq7YKJUCoctHBagQ?width=1040&amp;height=231&amp;cropmode=none\" width=\"1040\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"253\" src=\"https:\/\/0wwjmw.dm.files.1drv.com\/y4m_FizHtmW4OCoT7LirQpo3JZmI04flecaVYEGVPJMXyOF0O3wWArZDHCEAfLVCtRjq-t0zO0Dgxf3Yn2fgeE2SNIulU645sQ1e1tMa22LLYVGYgeZad0heN0eQzXDggZ1LHLFVgV0CoUL3Oy6ZOsCiKF1NRDYRAFmEiAhixwuejkb6_jBn6oSgPM0Q7frf8O9KLEf8qvqMfsdnapjnULH3w?width=643&amp;height=253&amp;cropmode=none\" width=\"643\"\/><\/p>\n<h3><strong>Step 5: Get the PDF Information from SharePoint<\/strong><\/h3>\n<p>Now if you want to just get down to business, feel free to skip to bit where I show the next action to add. But if you want to know what we are going to do, read on!<\/p>\n<p>This Flow leverages a little-known capability of SharePoint that among other things, allows us to generate image thumbnails and PDF\u2019s of documents. This capability is an API with the nerdy name of <strong>RenderListDataAsStream<\/strong>. In a nutshell, it is possible to pass a reference to a document and it will dutifully spit out the URL to a PDF version.<\/p>\n<p>To do this, we need to pass 4 things to the API.<\/p>\n<ol>\n<li>The document library where we want to get the file from<\/li>\n<li>The folder where this file resides in the library<\/li>\n<li>The SharePoint ID of the file we want to PDF<\/li>\n<li>A special code that tells the API to bring back a URL of the generated PDF<\/li>\n<\/ol>\n<p>For reference, a sample API call for a file with an ID of 14 in the default SharePoint document library in a folder called \u201ctest\u201d would look like this.<\/p>\n<p><strong>https:\/\/culmsee.sharepoint.com\/sites\/flowoftheweek\/_api\/web\/lists\/GetbyTitle(\u2018Documents\u2019)\/RenderListDataAsStream?FilterField1=ID&amp;FilterValue1=14<\/strong><\/p>\n<p>Don\u2019t try the above link in the browser, as it is a POST request. Additionally, we need to send some information in the request body too, namely the folder where the file resides and the code to get the PDF URL. The body looks like this:<\/p>\n<p><strong>{\u00a0 <\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 &#8220;parameters&#8221;: {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;RenderOptions&#8221; : 4103,<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;FolderServerRelativeUrl&#8221; : &#8220;\/Sites\/FlowOfTheWeek\/Documents\/test&#8221;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>} <\/strong><\/p>\n<p>Ok, so what is the deal with the <strong>RenderOption<\/strong> number above? Well, this API does lots more than just generate a PDF, and that parameter allows you to specify what information you want back. The documentation includes a table of different interesting things you can return, which you can do by adding the values together.<\/p>\n<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:589px;\" width=\"589\">\n<tbody>\n<tr>\n<td style=\"height:19px;\">\n<p>Label<\/p>\n<\/td>\n<td style=\"width:397px;height:19px;\">\n<p>Description<\/p>\n<\/td>\n<td style=\"width:60px;height:19px;\">\n<p>Value<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"height:18px;\">\n<p>ContextInfo<\/p>\n<\/td>\n<td style=\"width:397px;height:18px;\">\n<p>Return list context information<\/p>\n<\/td>\n<td style=\"width:60px;height:18px;\">\n<p>1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"height:19px;\">\n<p>ListData<\/p>\n<\/td>\n<td style=\"width:397px;height:19px;\">\n<p>Return list data<\/p>\n<\/td>\n<td style=\"width:60px;height:19px;\">\n<p>2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"height:18px;\">\n<p>ListSchema<\/p>\n<\/td>\n<td style=\"width:397px;height:18px;\">\n<p>Return list schema<\/p>\n<\/td>\n<td style=\"width:60px;height:18px;\">\n<p>4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"height:37px;\">\n<p>EnableMediaTAUrls<\/p>\n<\/td>\n<td style=\"width:397px;height:37px;\">\n<p>Enables URLs pointing to Media TA service, such as .thumbnailUrl, .videoManifestUrl, .pdfConversionUrls.<\/p>\n<\/td>\n<td style=\"width:60px;height:37px;\">\n<p>4096<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<\/p>\n<p>So, we are asking this API not just to bring back the data associated with a list item, but also some additional useful stuff. The last entry is particularly interesting as it mentions a mysterious beast known as the Media TA <strong>service<\/strong> which I assume means either \u201ctranslation\u201d or \u201ctotally awesome\u201d :-). Basically, what happens is if we <em>total<\/em> the numbers listed in the above table (4103), we will end up all the data we need to do PDF conversion.<\/p>\n<p>Okay enough talk!<\/p>\n<p>Add a <strong>SharePoint<\/strong> action called <strong>Send an HTTP request to SharePoint<\/strong>. Set the <strong>Site Address<\/strong> to the site that contains your document library and set the Method to <strong>POST<\/strong>. Set the <strong>URI<\/strong> to <strong>_api\/web\/lists\/GetbyTitle(&lt;docLib&gt;)\/RenderListDataAsStream?FilterField1=ID&amp;FilterValue1=<\/strong>, where <strong>&lt;Doclib&gt;<\/strong> is the name you specified for the document library<\/p>\n<p><em>( for example, mine is _api\/web\/lists\/GetbyTitle(\u2018Documents\u2019)\/RenderListDataAsStream?FilterField1=ID&amp;FilterValue1= )<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"299\" src=\"https:\/\/ojhhka.dm.files.1drv.com\/y4mUKD5wu5cTZ3MX_WXScjfhjgkFjJ-iZtmcMqWXSH-BrW8qFKMwMZBqtFPYLXl6IxJTdFvIUBv1rMBbxInBrvfxZtEru1TLL9t8v7ohz_miVXPS_-FmaGSDxlY3-jsMZvCgzBIk0X8IDxQF67Wf2VW3D6nuAnfkB_WyaglD8RUeghWNy0CuMfvHA-xpQPfcmgp-zlPygda3Ib28aBI_eA6Aw?width=631&amp;height=299&amp;cropmode=none\" width=\"631\"\/><\/p>\n<p>Finally, on the end of the URI, click <strong>Dynamic Content<\/strong> and choose the ID variable as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"642\" src=\"https:\/\/q6rdsa.dm.files.1drv.com\/y4mvNdKsQ269Bx8-YLLzGHXHTSaj-heQ36-Ec02cHnyHiyaHw2FenXmq2zSmysAnCpsymEdbv3Vqpq2Zk7uGZ6Qb11LGINuUNiliaJu2c4U5pMc-NIXkUeelDD_gm59ObrcQRviddMKh_YkAktaeY9jp0_-Alapwo_daJ4y3OM2O4ZksmGTSXoqiwXVf4cjlwGOK9oau13fHT00o93oR_riXA?width=1413&amp;height=642&amp;cropmode=none\" width=\"1413\"\/><\/p>\n<p>In the Body section, paste the following configuration (watch the quotes when pasting from this article):<\/p>\n<p><strong>{\u00a0 <\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 &#8220;parameters&#8221;: {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;RenderOptions&#8221; : 4103,<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;FolderServerRelativeUrl&#8221; : &#8220;\/&lt;your site collection URL&gt;\/&#8221;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>} <\/strong><\/p>\n<p><em>In my case the FolderServerRelativeURL was \u201c\/sites\/flowoftheweek\/\u201d but if you use the root site collection, it will simply be a slash \u201c\/\u201d.<\/em><\/p>\n<p>Finally, place your cursor just after the slash in the <strong>FolderServerRelativeURL<\/strong> parameter and from <strong>Dynamic content<\/strong>, choose the <strong>FolderPath<\/strong> variable.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"709\" src=\"https:\/\/edycpg.dm.files.1drv.com\/y4mY3Cw4kVb11KCFQhLhwxi9nVxeJpWroVeKjSY72JTTIcXdQ5aAED035EB9Nr3uiIBHrgYzoE80ADDsnFm2rgc56_-Kcq1ALpj2JHs70mlns6Mnts02FeQNKaLAnb1p9FMCzrIHHDTUJFNdGxkMO7rgA85CLEwwQaOISnULgz9SyeIAkxaGY5XB9OoamTfFdeU5pdkQVBNV90RpjkJj8GW0w?width=1405&amp;height=709&amp;cropmode=none\" width=\"1405\"\/><\/p>\n<h3>\n<strong>Step 6: Save and Test the Flow<\/strong><\/h3>\n<p>At this point, click the <strong>Test<\/strong> icon in the top right of the screen. Choose the option <strong>I\u2019ll perform the trigger action<\/strong> and click the <strong>Save &amp; Test<\/strong> button. On the popup that follows, click the <strong>Continue<\/strong> button and on the next screen, type in the <strong>ID<\/strong> number of one of the documents in your library and the <strong>folder path<\/strong> the document resides in.<\/p>\n<p>For example: The first document uploaded to the library will likely be <strong>ID 1<\/strong> and if is the default SharePoint document library, the folder will be <strong>Shared Documents\/<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"561\" src=\"https:\/\/4zmsjg.dm.files.1drv.com\/y4msC0eVnSLVIgMNwsWfaFiyoWpdNiZBX6XeYmBQBT15Vl47hkCKa0qsAxQ5gaOnE_K3Rc6IGyXo8EbeGNDfsnMgVFXsvS__rPOh3QCdUonboUf-1UhI0FKWOWkeK2RfCnxLhmFA8mR_SaPzwEOjjwLOcfJQIVY61a7HmnyWZy5gCqFdpgmHPNLMIP1RZvnr333oDEhBMV53DLQDRKWOxkv9Q?width=699&amp;height=561&amp;cropmode=none\" width=\"699\"\/><\/p>\n<p>Click the <strong>Run Flow<\/strong> button. Your flow will start and you can click <strong>Done<\/strong>. Assuming it worked, you will see a green tick of happiness in the history.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"297\" src=\"https:\/\/f31h0w.dm.files.1drv.com\/y4mOWqX8qhf8WKoMh8c-plEQPbQsF5a6_eAhjOQl2WpBhRiwAn0p6f_wb6PVOlyhtRP89gWpVsncX2tOhl_wUYVteZLtba8M4pjHv30kgnZLUOeaz-N-vZkeOvw9KrlocdpAts2DE8fAnbvnWkFtgvxNrWwld604h6zkDrv--IODFyayZlLRILXgARqAim6qg0g4rwcquAjDG9eHGDy5KtpfA?width=577&amp;height=297&amp;cropmode=none\" width=\"577\"\/><\/p>\n<p>Click on the <strong>Send an HTTP Request to SharePoint<\/strong> action to expand it. We need to grab the output from the API call for the next action. Find the <strong>OUTPUTS<\/strong> section and copy the entire contents to the clipboard\u2026.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"1125\" src=\"https:\/\/rh9r6w.dm.files.1drv.com\/y4m8106fZ5ks_3gvKu9ooyzG24lCyHbXgpmziaC2WqSoVVI2TBMuH4FcdUdBojrfHdMJdd7D3mdzLe9x0xzu80RVQJ-ggwaqb7JpzOB0qUnpLwnKqrO1f37ib74JHrYrZZQ9kF00rxatM-OEDIxQzCN3EY-DMUAXk_44PHoqzL8Rx1zCkeZgQNkaTyRypEihvISvjc7edyjDS2fDIBbZygNVQ?width=994&amp;height=1125&amp;cropmode=none\" width=\"994\"\/><\/p>\n<p>Note: If you made an error (e.g., you asked for a file that does not exist or the document library is empty), <em>then the subsequent steps will fail<\/em>. You can quickly sense-check this by looking at the clipboard output in notepad.<\/p>\n<p>If there is no file found, you will see a line \u201cRow\u201d: [] in the ListData section like so\u2026<\/p>\n<p><strong>{<\/strong><\/p>\n<p><strong>\u00a0 &#8220;wpq&#8221;: &#8220;&#8221;,<\/strong><\/p>\n<p><strong>\u00a0 &#8220;Templates&#8221;: {},<\/strong><\/p>\n<p><strong>\u00a0 &#8220;ListData&#8221;: {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 &#8220;Row&#8221;: []<\/strong><\/p>\n<p>\u00a0<\/p>\n<p>But if you did retrieve a file, there will be heaps of data inside Row like so\u2026<\/p>\n<p><strong>{<\/strong><\/p>\n<p><strong>\u00a0 &#8220;wpq&#8221;: &#8220;&#8221;,<\/strong><\/p>\n<p><strong>\u00a0 &#8220;Templates&#8221;: {},<\/strong><\/p>\n<p><strong>\u00a0 &#8220;ListData&#8221;: {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 &#8220;Row&#8221;: [<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;ID&#8221;: &#8220;1&#8221;,<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;PermMask&#8221;: &#8220;0x7ffffffffffbffff&#8221;,<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [snip a heap of stuff]<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p>Note: The output needs to have row data before moving to the next step<\/p>\n<p><strong>Step 6: Add an action to help us work with APi output<\/strong><\/p>\n<p>Go back to edit mode and add a <strong>Data Operations<\/strong> action called <strong>Parse JSON<\/strong> to your flow. This action will allow us to make use of the output of the API call in the subsequent flow step.<\/p>\n<p>Click the <strong>Use sample payload to generate schema<\/strong> link, paste your clipboard contents into the window and click the <strong>Done<\/strong> button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"356\" src=\"https:\/\/fai6ma.dm.files.1drv.com\/y4mn9AT72b-ESnE-ji2H-KqFKsMzm6jfqUiwC1YQcAAzQ3YLfmuw1OTrXFeQoV1wAHwxnF-yvwkcPluMIqHp5tswH-NHgrfsCcWIl3zNFIbO1f1Svyxxqv6DRsTDNYYPHK-USJwrTdsD_QY6pq5gS128GN3YX69hCGLnfj9SnhD2wI2Td0U-BWPNSNAIbUe0hQWhlm7PQkp9B_7d0ip4sczFg?width=746&amp;height=356&amp;cropmode=none\" width=\"746\"\/><\/p>\n<p>In the <strong>Content<\/strong> field, go <strong>to Dynamic content<\/strong> panel and choose <strong>Body<\/strong> from the <strong>Send an HTTP Request to SharePoint<\/strong> action.<\/p>\n<p>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"681\" src=\"https:\/\/twawga.dm.files.1drv.com\/y4mM-pEYrqCdvz3eqTAD6Q8Q_lLR_rYzZ0wo8pGsp_dPy_QqyWJFREfUIpQxSbS5lby6Yzq76x0ym4t0JOxFW5CsVpW51aOS_t3URbgRLErn76MUCAXRZCu3Ca-87b4q17gurs46xC5gHyY1_aGIHs_VulqMkbBiV8hST3dJ0fWwaNelSqjAo35XejsjlkHIgfU7AOqidmVfWS7V38REk3XTQ?width=1366&amp;height=681&amp;cropmode=none\" width=\"1366\"\/><\/p>\n<h3><strong>Step 7: Construct the PDF URL<\/strong><\/h3>\n<p>Now when this API is called, <em>a lot<\/em> of data is returned. The purpose of the Parse JSON action in step 6 was to process all this output and turn it into flow objects to make our life easier here. This allows us to quickly grab only certain data from the output of the previous flow step without having to parse the output ourselves via more complex expressions.<\/p>\n<p>At this point, you might be thinking that one of those is a nicely formatted PDF URL all done for us. Unfortunately, this is not the case. Microsoft give you all the bits you need, but it is up to you to put it all together. As a result, we need to do some more work to create the URL by trawling through some of the data returned by the previous step.<\/p>\n<p>Of all the output currently in your clipboard, the main one that interests us is this entry\u2026<\/p>\n<p><strong>\u201c.pdfConversionUrl\u201d: \u201c{.mediaBaseUrl}\/transform\/pdf?provider=spo&amp;inputFormat={.fileType}&amp;cs={.callerStack}&amp;docid={.spItemUrl}&amp;{.driveAccessToken}\u201d<\/strong><\/p>\n<p>This parameter is basically a template for generating the PDF URL. All the stuff in curly braces are <em>tokens<\/em> that have to be replaced by the actual values that are also returned as part of the API call. For example, if I search the clipboard content for the first token in .pdfConversionURL called \u00a0{.mediabaseURL}, I find this entry&#8230;<\/p>\n<p><strong>\u201c.mediaBaseUrl\u201d: \u201chttps:\/\/australiasoutheast1-mediap.svc.ms\u201d<\/strong><\/p>\n<p>Now go and look at .pdfConversionUrl again. Replace {.mediabaseUrl} with https:\/\/australiasoutheast1-mediap.svc.ms and now we have<\/p>\n<p><strong>\u201c.pdfConversionUrl\u201d: \u201chttps:\/\/australiasoutheast1-mediap.svc.ms \/transform\/pdf?provider=spo&amp;inputFormat={.fileType}&amp;cs={.callerStack}&amp;docid={.spItemUrl}&amp;{.driveAccessToken}<\/strong><\/p>\n<p>Get the idea? We need to replace the remaining tokens ( {.fileType}, {.callerStack}, {spItemUrl} and {driveAccessToken} and replace them. Once we have done this, we <em>finally<\/em> have created our PDF URL. When we subsequently access that URL, we will receive the converted document in PDF format without needing to store the PDF. The source document can stay in its native office format!<\/p>\n<p>Phew! Now let\u2019s get this done\u2026<\/p>\n<p>Add an <strong>Initialize Variable<\/strong> action to your flow, name the variable <strong>PDFURL<\/strong> (or something similar) and set its <strong>Type<\/strong> to <strong>String <\/strong>format. <img loading=\"lazy\" decoding=\"async\" alt=\"image_thumb[35]_thumb\" border=\"0\" height=\"171\" src=\"file:\/\/\/C:\/Users\/PNWPC\/AppData\/Local\/Temp\/msohtmlclip1\/01\/clip_image050.png\" width=\"563\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"229\" src=\"https:\/\/sveidg.dm.files.1drv.com\/y4mCxvbK244MRZWuOyL6A9efYC9qrGIoFtTFhwCiBW9Nkc6lPKpg3jtdmPBZ_apm5pzwgTDBoFafCUYQM2SlFfgHEbhaQeZTylqqHLwPX6sP1JHehqNETOdcNuJI_z_LOHhqcu_jICJYksmuZDcQs36UR1O04wZwOVoJVr4tCMr2PbdJZ57QpqidqHlS8z7rxjjPNHP6aE8p8CJsmt-uCizVw?width=754&amp;height=229&amp;cropmode=none\" width=\"754\"\/><\/p>\n<p>Now we come to the most complex bit of the flow where we have to substitute the tokens we just examined. Be careful here as this is the most likely place to make an error. In the Value textbox, click the\u00a0<strong style='font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>Dynamic content<\/strong>\u00a0flyout and find\u00a0<strong style='font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>.mediaBaseUrl<\/strong>\u00a0from the\u00a0<strong style='font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>Parse JSON<\/strong>\u00a0action\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"555\" src=\"https:\/\/0wwimw.dm.files.1drv.com\/y4msjGIUC3zdwzQevoQlEpc_os3GbrfQFhE6xZW1gV5CoLkoBz9s5AjJo_3ieB9azF8Nu0Y07Q_LMjedN1Lec3hOUSdS6gfC5itkRk0nm8VAOYPgyUGw-MdR-xfo7kzXn7fnwlGTfDb4J14TvSz1IBEClH_1tYIEUzCMtbp5PHjdTYW3hyiFpJkbBQQg2bV-cWcTdTd8sAqt-F5moZM3_sYCg?width=1463&amp;height=555&amp;cropmode=none\" width=\"1463\"\/><\/p>\n<p style='font-weight: 400; font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>Next, add the following text to the\u00a0<strong style=\"font-size: 13.008px;\">Value<\/strong>\u00a0textbox, taking care not to delete what you just added in the previous step.<\/p>\n<p style='font-weight: 400; font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>\/<strong>transform\/pdf?provider=spo&amp;inputFormat=<\/strong><\/p>\n<p style='font-weight: 400; font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'><img loading=\"lazy\" decoding=\"async\" height=\"185\" src=\"https:\/\/ojhgka.dm.files.1drv.com\/y4muUmWPm5QkdgCUPjDcVuBEMpyamph1Ep7VlxvJLR2K1S3aW4vZA8gDUO2pRkdDuurRxKX2Du2zAuPIlwZ1pI9byutImRmcYiZDIbHkIBRkUIEiGskpOwPCmHIGGYfowsPidwJ2XPsriYY6rKrKOTAQamFLobQLs1CHVKhmEhiBJFUqlRqzrccsMifFNVZSfKJfxKMHmAnuheXr4C7KSghlA?width=560&amp;height=185&amp;cropmode=none\" style='font-weight: 400; font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;' width=\"560\"\/><\/p>\n<p>Now we come to a slightly tricky bit. The next bit of content we need is the <em>file type<\/em> of the document we are dealing with. The bit that is tricky about this even though we are only asking for a single file when we call the API, it comes back as an array. Why? Well this API allows you to process multiple files in one go, so it always returns an array in the output, even if you only requested a single file.<\/p>\n<p>The offending bit of data returned by the API is shown below. Inside a <strong>ListData<\/strong> object, we have a an array of <strong>Row<\/strong> objects:<\/p>\n<p><strong>\u00a0 &#8220;ListData&#8221;: {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 &#8220;Row&#8221;: [<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;ID&#8221;: &#8220;1&#8221;,<\/strong><\/p>\n<p>We need to get the file type of the document, so the PDF converter knows what it is dealing with. Like the way we dealt with removing the trailing slash from the FilePath variable in step 4, we can use another expression to handle it. Click the <strong>Expression<\/strong> tab and type in the following:<\/p>\n<p><strong>first(body(&#8216;Parse_JSON&#8217;)?[&#8216;ListData&#8217;]?[&#8216;Row&#8217;])?[&#8216;File_x0020_Type&#8217;]\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>What this expression is doing is assuming we are only handling one file at a time and grabbing the <em>first element<\/em> of the <strong>Rows<\/strong> array and then grabbing the <strong>File_x0020_Type<\/strong> property.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"355\" src=\"https:\/\/q6rksa.dm.files.1drv.com\/y4meKw0zns1LyTRI1umjVHUqr8CvVs9dJXO1VcxSUSs7BnFlqX9RNVEEF54aNThy-UFBmTJtYMcm0CJRluKtXGE_KUV1Gsb_EkEKVBvDxA162OxhdWdWR8tlXI-2S4bDjh5ZYTcrU9GCW-kTBiDo_WSwTlhOzdDranngP9UiRczBVLB2d814sam_lbtEYPBTfV0-bkR7Ylc2Iafbjvx3W2smg?width=1482&amp;height=355&amp;cropmode=none\" width=\"1482\"\/><\/p>\n<p>Next, add the following text to the Value textbox, taking care not to delete what you just added in the previous step.<\/p>\n<p><strong>&amp;cs=<\/strong><\/p>\n<p>Also, be super careful here because at the time of writing, the cursor in this textbox can randomly move and wipe out your edits\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"185\" src=\"https:\/\/edyjpg.dm.files.1drv.com\/y4mNHvNUFrtbEy_FMHOI8drlb-dkeiq7d_AWqPM2q0irui1Po2XFDUQRwRWnyqSSZN0fc8RtvvfiL4rW90hHTTZQhlWYYax74DK3cVrTbKfAA6Khac9fbE_mskI6Ej8QpBbKclJycNqZ5YFkt2G_YwnjvH7umAM7vvBkKAwrwqHuq90ygeFmuXU4_3j68ESA621ImPRo4JTpE0IuC9qIzzU0Q?width=564&amp;height=185&amp;cropmode=none\" width=\"564\"\/><\/p>\n<p>Now in the <strong>Value<\/strong> textbox, click the <strong>Dynamic content<\/strong> panel and find <strong>.callerStack<\/strong> from the <strong>Parse JSON<\/strong> action\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"425\" src=\"https:\/\/4zmzjg.dm.files.1drv.com\/y4mxjNmu_WojIPwkWsCa3Z1HCr-El-7v36qVDF7VPrAYZXnWaj40oqyLc9tAgnAT7uvsY51KyIKo_zK4zJ-5ZZ92dOTcx8KVqrx8nTMZoIFO-mi-BhHZXT6oPIV51EhwyTMOS-VuGueZuYN8dRCM_z8YT0MbdKSntpOCrF_fZsLJd_8hnV3h837pxZXFoq1RUJvOSktQBy-yBawoARbPq48Jg?width=1280&amp;height=425&amp;cropmode=none\" width=\"1280\"\/><\/p>\n<p>Next, add the following text to the Value textbox, taking care not to delete what you just added in the previous step.<\/p>\n<p><strong>&amp;docid=<\/strong><\/p>\n<p>Now we come to another array that needs to be handled. This is the URL of the document we are dealing with. Click the Expression tab and type in the following:<\/p>\n<p><strong>first(body(&#8216;Parse_JSON&#8217;)?[&#8216;ListData&#8217;]?[&#8216;Row&#8217;])?[&#8216;.spItemUrl&#8217;]<\/strong><\/p>\n<p>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"341\" src=\"https:\/\/rh9y6w.dm.files.1drv.com\/y4mw9MzSEAaH4w32KbQRu-MbMomIDUL0PmMYCD8-q8dcgHS4cEgDc1KG3FAIrOc-aHGfKWybwmp05kKmApPhySPyNMB3WrnvA7ZE9ozLZItlwIjmrZVi-ru43AtHCuzSUpf3IieASxZwKnAWtvaGDl-k7G85Avwvtxo48K2j5wa_YepByJLJf9oThjuo3lwxsff_nz9-iHZPsOSS5Qu8NVh3g?width=1359&amp;height=341&amp;cropmode=none\" width=\"1359\"\/><\/p>\n<p>Okay we are almost done\u2026 Add an ampersand ( &amp; ) to the <strong>Value<\/strong> textbox, and then click the <strong>Dynamic content<\/strong> panel and find <strong>.driveAccessToken<\/strong> from the <strong>Parse JSON<\/strong> action\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"450\" src=\"https:\/\/twa3ga.dm.files.1drv.com\/y4mISNTiTlZ_U_I8L6d5Xe5QAecI-tniwlG_gy6M0Q85dgjWR4rsFMEKzTHG9jtXZpjCXuxh806U_zEyl3TehANLeSSNoTD3t8SBZjww1-p1h_IZ8haljCjM_ZFCpgv9dy1fJEJGYZUkoxY04xMXb1QtyNY41SjcQUfsNRWZXe1iITeuqr6LrPRyjajf6TH19eUp1mPxl-uiCnq1ZJVLGSDdA?width=1333&amp;height=450&amp;cropmode=none\" width=\"1333\"\/><\/p>\n<p>Whew! We are done. I realise that was a bit of effort for one flow action, but it will all be worth it in the end. As a final step, rename this task to \u201cGenerate PDF URL\u201d.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"209\" src=\"https:\/\/f31o0w.dm.files.1drv.com\/y4mtjrKrBldrnaM5SfJghP4NtNmDHdRuKQWIl3Tj1AYAGGE2kex_iiDzSiSHXZ0OaycorlS7bEr1mnCGYkxK18PpXrVeAVSosnpxtizHMa8GtKoVO4hSs0aktxfvrT9bj0D54VWcsCbKPrTknSvB3KkgEmAVQIVkYbRtP1_oPDm8Y9hmOi5iSgj_bJoWOIYGkA0Ww_OiA1xLbvZo-QLImV2Pw?width=555&amp;height=209&amp;cropmode=none\" width=\"555\"\/><\/p>\n<p><strong>Step 8: Send the PDF URL back to PowerApps<\/strong><\/p>\n<p>Add the <strong>PowerApps<\/strong> \u2013 <strong>Respond to PowerApps<\/strong> action to the flow. Click the <strong>Add an output<\/strong> icon and choose <strong>Text<\/strong> from the list of output types. Name the output <strong>PDFURL<\/strong> and set the value to the variable you created in step 12 (<strong>PDFURL<\/strong>).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"293\" src=\"https:\/\/fajbma.dm.files.1drv.com\/y4mNLWmS3TmUCKyeOhfeBVbcpHQVnj1XG6dTT4YSOtwgWTbpYAeOYW4ZZjG8D1MIiM7MTbOMDU4VrKFq9EA_S-FCZlHQFIbTQgruDFiTXTWy3HMuCCSy7grqaM-OOLSUzdKWLgLlXTJ0A2y5DJrNlSVaPE0FZmgHPd1BBSenM07lUcns5HS_Msj2vWvj3ZCLfmSJg3ZEruvHlqAxNmAZ0bTSQ?width=882&amp;height=293&amp;cropmode=none\" width=\"882\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"389\" src=\"https:\/\/svepdg.dm.files.1drv.com\/y4mdLbRz6piT-DW8GeZ7tx42qlpG7lRb2FCmqBse3ntcI8OYFcHxUNKBrVv7x-PE0R3TIncAu-HHW9G_4OkBHymE6MMo2qyR_-EWheEOtq_rstL7j1FNzymkD8ZIpj0o3y422dwQrBeAIrV-vUTBq3lxfM3O76JaGa7Q77E7_jQ2GLEwJuegFuEdpW-qNFlXaLpBsdNFswEiUqpPtHl9MD8Tw?width=1170&amp;height=389&amp;cropmode=none\" width=\"1170\"\/><\/p>\n<p>Ok we completed the flow. Save it and give it a quick review. It should look something like this\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"1416\" src=\"https:\/\/0wwpmw.dm.files.1drv.com\/y4mTC_mPmrrJSVK038P3Pudo3WzAQU86xfBM7rMDFHAfSe-7vdQnurwwvvH4HQ68tfDib-2fvDt-B21BgiTTIkfUIL5Tr9mnUzxsqzY_In0q4BcSPJ1TyL6skqW39WE4ZP1Qtu9gAURFrdehosDBq4AnCLrY_08S1mlZ1jBm1SxKCCO2UNneT3IziJxdXojoJnPa6aEk8s0zP5XgwoI-difMw?width=561&amp;height=1416&amp;cropmode=none\" width=\"561\"\/><\/p>\n<p>If you have not done so already, save your Flow and give it a short, sharp name like <strong>GetMyPDF<\/strong>.<\/p>\n<h2><strong>Building a sample PowerApp<\/strong><\/h2>\n<p>Now let\u2019s build a sample field worker iPad app. This app will allow a field worker to choose an equipment type, and then based on the equipment type, choose the available document types for it. While we will not win any design awards for this proof of concept, the added-bonus is you can learn how to do cascading dropdowns using SharePoint metadata.<\/p>\n<p>The concept is shown below. First our trusty technician picks the equipment they are dealing with (step 1), and then they further refine by document type (step 2). Since the dropdowns cascade, only document types that exist for a chosen piece of equipment will be selectable.<\/p>\n<p>This in turn refines a list of matching documents, irrespective of which folder they actually live in. From there the user clicks the \u201cgo\u201d button (step 3) to display the PDF version (step 4).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"673\" src=\"https:\/\/ojhnka.dm.files.1drv.com\/y4mBm3n3oJ6m8JUsYONrcdDsn58W01alYMA2pE-sWOw3oD1TM5LQGFlfM7RKq6H_K-7PCgyD9DsC85Ml4QnnOcLAn6mOdY-Ub74HvB-zbVm7m5PXpupY8otv6hUHDLPWJnCGnjYCfwS-UYCYr7-eYgpQ4hK0P941UiVm0D0HoXI7NeUGToJVYpleiNxHVEXdq6NVZqaOq_4ERd3JT7bPDO3DQ?width=1452&amp;height=673&amp;cropmode=none\" width=\"1452\"\/><\/p>\n<p>To create the app, in the PowerApps portal, make a canvas app from blank and choose the <strong>Tablet<\/strong> form factor\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"525\" src=\"https:\/\/q6rjsa.dm.files.1drv.com\/y4mHbiRGkqSkZfhFntDekGvxczDmGjYdWGtxkTZZscBFn9XF6uCocJ7C4xXz5qf2i4ZVWyydSxNyRtHYd-tQoNhIhc6MNum1ey_LItwI7GTHGUwrbXA7SxxY9wcGiFQTCemxUnIAKKZg07BrEeQcAgbd6AcbeH-UeoNEbgWLGT5Ta-Epy_c4DhZis7OIO32c395ZuKwKjikn3z8SoZadkf19w?width=408&amp;height=525&amp;cropmode=none\" width=\"408\"\/><\/p>\n<p>Next, let\u2019s connect the app to the SharePoint document library we used at the start of this article. From the <strong>View <\/strong>menu, choose <strong>Data Sources<\/strong> and click the <strong>Add data source <\/strong>button. Make or use a SharePoint connection and choose the site collection where you uploaded the documents.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"269\" src=\"https:\/\/edyipg.dm.files.1drv.com\/y4mX9BtqB6YC-adPF41QEVGAiL8Kgmez1aEHqX4rpdSHDwz2IVEwBWLHK3shOEIpUwa5_YCs1Jm9WQ78SN7OEWqST5RAksjMcX-SI32hHHbPHYGhws7Vybw1vYHRtWEeYHILNQu-JeZTITMUsim0iH0K6fwMAXtG7HxGw_e3wVy609bINl47dIU2PBpiSe20aEW8POAdHCjRmS5YduQNcPUUA?width=404&amp;height=269&amp;cropmode=none\" width=\"404\"\/><\/p>\n<p>Click the <strong>Go<\/strong> button and manually type in the name of your document library and click <strong>Connect<\/strong> (at the time of writing, you still have to link to SharePoint document libraries by typing in their name).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"318\" src=\"https:\/\/4zmyjg.dm.files.1drv.com\/y4mBP_DfvQ635tmaXZWYQpIB747tM3-HOvtmKAZHUtm_kufLjGnr_MwGANKC_QW2ei61x4rK4LovAFCse3EIi6ZVeHMZ-SXjw7iTJ9DZJggBAMGqksnenQF6uHXrdxehoRYBYdWUk2x_h14gyOwcjVLhDcsXb-6rbZTFrUGdABEKONsh0H9TI8TJvgkgvZcYjYWCS9GtdpNbO8XrbaL89JsoQ?width=405&amp;height=318&amp;cropmode=none\" width=\"405\"\/><img loading=\"lazy\" decoding=\"async\" height=\"213\" src=\"https:\/\/rh9x6w.dm.files.1drv.com\/y4mLgtRosSPWyzad4-ANdSsF3rUU5SDK0CnTjKbx75ZHGEDIoA9v9hf6ZplgfXRSEGHeatwPCWwpdtXzsZscnt9rEz1C4WC7JRbRbkcc9D3Tf2s_90Mu8TmNiA4txmDd0Q99vfreK6dLVTwtbqfpm5_u7gf6cXZexqAqPhKqS3e35vQP51Do2UuWgHEkIuYp52ed40GuzY2u7nxK2zwLtgSng?width=403&amp;height=213&amp;cropmode=none\" width=\"403\"\/><\/p>\n<p>From the <strong>Insert<\/strong> menu, choose <strong>Gallery<\/strong> and add a <strong>Blank vertical<\/strong> gallery. Set the data source to the connection you just made\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"442\" src=\"https:\/\/f31n0w.dm.files.1drv.com\/y4mz9QCq8kl4wysldGuuIBh9_w1DBKNEO851yQCQbs8fATnUoGFUnJ9pzGePqu-IJvD88_virM8VrUROfWA0KeRvVHV6brkMDd8K1LtLLGXG1YAcZ8nfZcwWt9-Fhf235_fRS4RLwQjvtF-ndY6cE0TJOYumQe8K_BfrLZ0W-Koxgw8cxPwUiPEw-aCjX6PSCaBMSy08FbytSaYk2z3_xsu6w?width=335&amp;height=442&amp;cropmode=none\" width=\"335\"\/><img loading=\"lazy\" decoding=\"async\" height=\"455\" src=\"https:\/\/fajama.dm.files.1drv.com\/y4mmXDlwdI-Fjf3abUosEAHOKJZCEQdbJZqrOXTXuZr_xWUXiXNb9O5h1ivUctKlCFKGDbAAo7ckw1S74lRsWVvV88YCCu_KYPUPfd2Op_ZkZZHILdVZGLTqSUSPgSBiNOLIPJwpjpPWhDJut4C2gz5H4_LbbDdTXC2n-SnD1pw4TyTtYpnFPiccedQYw2WFaqriH9ZmRsT8SuFHUQ3KPDU-g?width=744&amp;height=455&amp;cropmode=none\" width=\"744\"\/><\/p>\n<p>Click on the pencil in the gallery, and then from the <strong>Insert<\/strong> menu, choose <strong>Label<\/strong>. Click on this label and in the <strong>Text<\/strong> property, change it to <strong>ThisItem.'{FilenameWithExtension}&#8217;<\/strong>. You should now see the files and folders from the document library listed.<\/p>\n<p>Note: {FilenameWithExtension} is one of a number of properties of a SharePoint library that PowerApps provides. We will soon use another built-in one as well\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"524\" src=\"https:\/\/twa2ga.dm.files.1drv.com\/y4mrLeHDaZ6CsiEM1aEICgm6kfYWYd6cGBQgPB7dTsxnTUOrscb2DzibMIrABsls8bEaICg9WI7l6_695HbSFeBixBHcarRsjQ-xZ7ULFn_kNuSv3a6Qn58Q3q4czHfPpSr15QrkWsjXnrxi1DIZH53TJ4vtfeVelyjgPdXS5FsPJyhGKUPfbl6OAy-iUIMGHFqh-4V_jCVhxz0hVgITK_EIg?width=844&amp;height=524&amp;cropmode=none\" width=\"844\"\/><\/p>\n<p>Now let\u2019s make use of the SharePoint columns we created at the start of this article. Recall that I made a column called <strong>DocumentType<\/strong> and one called <strong>Equipment<\/strong>. We are going to use these to filter this gallery so that only certain files are shown. After all, our field workers want to quickly get to the documents they need\u2026<\/p>\n<p>Click outside of the gallery, and then from the <strong>Insert<\/strong> menu, choose <strong>Controls<\/strong> and then pick <strong>Dropdown<\/strong> from the list<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"328\" src=\"https:\/\/sveodg.dm.files.1drv.com\/y4mXJ3PKngsjD8iWqHh2cUVMm9sHfzT7wzhBHcGebZsliHNgAD94l_0TusWWfXfFk-USUdf3RUfCU1lWet-z6B_O2IHlp0g9qQZ7tKiOQmSFH5nZ0oEIEJaSOUHajWoz4srhyUY3G1M3nBwiEiRp-pFY8-VspA8gd39lumpptADo-NsobUWRWQIgyJqqeuilDxnvN_avfVz9DdiA5jDFsn5oA?width=713&amp;height=328&amp;cropmode=none\" width=\"713\"\/><\/p>\n<p>Set the <strong>Items<\/strong> property for this dropdown to <strong>Distinct(Documents, Equipment)<\/strong>. If you then hold the Alt key, you will be able to click the dropdown and see the equipment. This list has been built from the SharePoint document library. The distinct function returns all unique values for the specified column (Equipment) without hardcoding the values.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"285\" src=\"https:\/\/0wwomw.dm.files.1drv.com\/y4mE3GSRKOenVSmZiEUt4vQ9lGaOh9F-Hr1eSQsySU9xjAkYWJzYVymdAIiBSD2r8HWG4Itf1aeYcSbocY0Rhabt73XwdXE89GI5Utu4l9iJXuxsT4K_xKwC5ap99vzhm_yfkyxyvCJVHgCSyeTX_DQn1znE-lG55gYNU6pR-XM8ZiosHza60emf2IY25aT4-0pmr3OWrp5FvkwSoAFfJpCBQ?width=840&amp;height=285&amp;cropmode=none\" width=\"840\"\/><\/p>\n<p>Note\u201d: We are seeing a blank value in the dropdown, because of the folder I created in this library which has not been tagged to a device or document type. But the empty value is seen as something unique by the Distinct function. If you want to make it go away, try this alternative setting for the Items property. This will remove the empty value\u2026<\/p>\n<p><strong>Filter(Distinct(Documents, Equipment), !IsBlank(Result))<\/strong><br \/>\n\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"194\" src=\"https:\/\/ojhmka.dm.files.1drv.com\/y4msl_oi1WUIWT2dHuFkdogBukEMis_yccJ6KoWBHz7HuDGPJJuO8Og--7U4fU1rjjnXVhJxV11Hxig72GiBeF2AdUO5VU7d9zaZIDmAIcaYVIvmupdNzXkFBRaGhioT9OD91TLqImFSovXl2kxomy1HAjER0HjTuzWPLnbYlVFlM7QX_TXIY2v6-ri3geq46dWxmk5avKYKKgfvXesm6xyfw?width=1052&amp;height=194&amp;cropmode=none\" width=\"1052\"\/><\/p>\n<p>Insert another dropdown and place it under the first one. Set the <strong>Items<\/strong> property for this one to<\/p>\n<p><strong>Distinct(Filter(Documents, Equipment = Dropdown1.Selected.Value ), DocumentType )<\/strong><\/p>\n<p>What this does is filter the document library to only items that match the currently selected equipment. Then it uses distinct to get all the <em>unique document types<\/em> for that equipment. This pretty much means you now have a cascading set of dropdowns. The values in the second dropdown are based on what was selected in the first dropdown.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"292\" src=\"https:\/\/rkrcsa.dm.files.1drv.com\/y4mGeOsUrDY7I1Wd5PpSskopHl-FpGcjlEtpY1sQkGCtkgzBr1VsRupCExcY7oGunJwWI4mGElCBPEoBf5ng_ATElu_YNNSx8CcANOY9uTOBwrUFoeThI20pSBDn_3Y-Zfqfw3QVwKn-4BHzTrOoSp4gSVhgpoGo7CQwUcLDykeHIMFw_p3dlaRfjtGyYuuxhAjAbrJPvY1P3m-WrTsIRyOzw?width=1272&amp;height=292&amp;cropmode=none\" width=\"1272\"\/><\/p>\n<p>Now let\u2019s return to our gallery and modify it so that it only shows items based on the dropdowns. In the Items property of the gallery, change it to:<\/p>\n<p><strong>Filter(Documents, Equipment=Dropdown1.Selected.Value, DocumentType=Dropdown2.Selected.Value)<\/strong><\/p>\n<p><em>Note that depending on the name of your dropdown controls, you might need to modify the text above. <\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"373\" src=\"https:\/\/etybpg.dm.files.1drv.com\/y4mXoyXRFLi9Cm6CZmnpnTk_F0Kz3xIpHW2CPGrHVYc-0bV5SkV9aHNb_RQcqT_THhlyh2-fFQxfKH0W2pIWPwJjgXNMqb14r5vLSdl10ai-m7aKW-RYX4s2Thf2J7Zaonv9pci0ked3nz1DCGYYE_0AGjHGCDyiJ7tlBuW3jPJd-xEWB4Beg29P1mO8dO1J5uNLvANyaCA9tJqCrNqLLPkIw?width=1379&amp;height=373&amp;cropmode=none\" width=\"1379\"\/><\/p>\n<p>Test by changing the values of the dropdowns and confirm that different documents are listed in the gallery.<\/p>\n<p>Next let\u2019s add a button to the gallery so a user can load the PDF. Select your gallery and click the pencil icon. From the Insert menu, add a Button and set the label to \u201cgo\u201d. Position it to the right of the file name. Also double check that you placed the button inside the gallery and not on the screen by confirming the button sits as a child control of the gallery in the left hand navigation.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"334\" src=\"https:\/\/4pmrjg.dm.files.1drv.com\/y4mU-ScczDSXC_bq5db1eMGcGGO3kgahBP0zC-x_VBCwSw14Lnu4ruFUoGrsYBZygaLow7dxJb8LLq97TcajIEZs0qis5oHm4JHMsc_CwJYtddPa2Baw55VFmHo_nnnHeQlZ8V4tujxTte6MmOpJSe9lmQGmU_CIIgep_0lj9vpw2t4QuilAgM7uYOhh2DzuLvCYgLz8mD4-olZUkheLDzfnw?width=964&amp;height=334&amp;cropmode=none\" width=\"964\"\/><\/p>\n<p>Click on the newly minted button and let\u2019s now call our PDF generation flow. From the Action menu, click on Flows and in the data panel, find your Flow.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"241\" src=\"https:\/\/gh1g0w.dm.files.1drv.com\/y4mvU7x92cRErMeJShCI3joeYbmIcUGjaze9p3VdFfqvjus3YQbqvKOp5zDS7uNdFzlB7DcP8TbosMsvTbqUvqX1yDCjiKYzz-Hy1im0ghggjC3TCsyE2z_9kKnP7EWUV_H4eg_8kHeuiUXb78hIkNfMgjZ2eh3vSachhuY73RXbFmtM3dbjWKOrxVpzMgO-_uu53gRxh9mtZ0clEa0HmU5ew?width=1172&amp;height=241&amp;cropmode=none\" width=\"1172\"\/><\/p>\n<p>If this worked, the flow will be asking you for the two \u201cAsk in PowerApps\u201d parameters that you set up earlier. For the first parameter, enter <strong>Gallery1.Selected.ID<\/strong> and for the second, enter <strong>Gallery1.Selected.'{Path}&#8217;<\/strong>. Your formulae should look something like this\u2026<\/p>\n<p>E.g.: <strong>GetMyPDF.Run(Gallery1.Selected.ID, Gallery1.Selected.'{Path}&#8217;)<\/strong><\/p>\n<p>Note: I am assuming your Gallery is called Gallery1.<\/p>\n<p>We are not quite done though, because we need to capture the output of running this flow as a variable. This will give us the PDF URL. To achieve this, modify your expression so that the flow is inside the Set function \u2026<\/p>\n<p><strong>Set(MyPDF, GetMyPDF.Run(Gallery1.Selected.ID, Gallery1.Selected.'{Path}&#8217;) )<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"313\" src=\"https:\/\/rx9q6w.dm.files.1drv.com\/y4mKHcNZa4I6wGCs_7Fyn0cXis0HoDKcqKzD8WJTCyFSTMIvosubkGNBf9-r3_RQKclUaam0WnK_kuTc75cXinOto32nyUwaFqACxP0lTbWUe5m6yz8TJSfHd6vprm0x6m2qu5wXhR_BjDuUYf4O_AKSpX8ceh5ZyRZlLVqhvZ70ejaINSNLPKes3qpHBHQqDdjy7kz7iD33uIVaSNmBB3QBA?width=917&amp;height=313&amp;cropmode=none\" width=\"917\"\/><\/p>\n<p>\u00a0<\/p>\n<p>If you want to test things at this point, simply preview the app and press the button. If flow has worked, you can see the variable via the <strong>View<\/strong> menu so see if a URL has been created.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"434\" src=\"https:\/\/fqi5ma.dm.files.1drv.com\/y4mmL1JyiiiwuRJmA3HPW0CYZJtVuY9Vch5Ym_5BTkvrJ7jl1Ivr5xlCq92eW0y6t53iDyjUfhgZ-KBX7wGzZXNqsBp8YUrBCF2HRUBg5XFAcxB7noglARThSCFDQ2ZQ-AxnOmAtElDzqgMwSbynqhiiqlPrJJhghjziN8vsZ6Hhn5oUAjPJUAoCRc5UY_Ukv1gwsLMqF9cASbJb9W-Mz6HaA?width=818&amp;height=434&amp;cropmode=none\" width=\"818\"\/><\/p>\n<p>Finally, let\u2019s display the PDF.<\/p>\n<p>From the Insert menu, choose <strong>Controls<\/strong> and add a <strong>PDF Viewer<\/strong> control. Place it to the right of the gallery and set the <strong>Document<\/strong> property to <strong>MyPDF.pdfurl<\/strong> as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"552\" src=\"https:\/\/tmavga.dm.files.1drv.com\/y4mi518xm0uQFw6QFgMUoTNJaurbkW8cqvpLCRIcXKOA346qEeWmWIhWhmKUlaPDkBIrIalZAwyLb54Kr3yZIFBESjVxx-ZJE6-9eeV8FNMRGIvNMcTVzo93_i9Z1t7zzHn4xu6u-fQZSFALp7TzjYaBR0qkSEfSgtZynHaUJ7h_t8407mW1-ZcOA1nglwXHiEmZXnLMSFLR1ryYiaJ0RAx-A?width=1149&amp;height=552&amp;cropmode=none\" width=\"1149\"\/><\/p>\n<p>If all things go to plan, you should be viewing PDF\u2019s. Use the dropdowns to find a different document and click the button to see the PDF. It may take a few seconds to load the first time, particularly if the original document is large, but it should happily display.<\/p>\n<p>Try some different document types\u2026 For example, below is a sample excel document that I loaded into the library\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" height=\"701\" src=\"https:\/\/sqehdg.dm.files.1drv.com\/y4m0CTtkP3jyd3YUkz6gnFo1X9IwGyYnVcSPMlfCbf0kwsj81yoyM1yRvABT_AT2eWpeK9ZH1tE_DxTD0J6gjooe4j8cmuqOZCTmOU-Bw7GkVekwqvBTy6RCvaiX0RHj_7DYfQsvAbUZEHlYd-pomjire8wPeC_WMSXgdL0luKAzmM3kWUE5BSKoDr7XPXHl2nh4s5TYMX9yi4DaO1deqly3w?width=1354&amp;height=701&amp;cropmode=none\" width=\"1354\"\/><\/p>\n<h3><strong>Taking it further (and caveats)<\/strong><\/h3>\n<p>In the real world, I have used this technique to deliver documents to field staff with much more sophisticated navigation and searching capability. It has been used on large construction sites to share safety bulletins and it has been integrated with more extensive PowerApps solutions for managing callouts\/jobs and managing assets. Field staff were stoked that they were able to quickly call up and view key information without having to navigate through a file share or SharePoint.<\/p>\n<p>By the way, this method <em>can also can be used to generate image thumbnails too<\/em>, making it excellent for apps that are photo heavy and bandwidth sensitive. I even utilised this the thumbnail variation of this technique to add photos to <a href=\"https:\/\/www.youtube.com\/watch?v=1vybZIBETVU\">activity feeds in apps<\/a> and have even used to create rich<a href=\"https:\/\/messagecardplayground.azurewebsites.net\/\"> action cards<\/a> in Microsoft Teams.<\/p>\n<p>Another use for this approach is its utility as a free PDF conversion tool. <a href=\"https:\/\/www.pdtech.co.uk\/\">Paul O&#8217;Flaherty<\/a> pointed this out to me that is more elegant than the commonly used <a href=\"http:\/\/www.cleverworkarounds.com\/2018\/03\/09\/three-ways-to-convert-html-to-pdf-using-microsoft-flow\/\">OneDrive Flow action<\/a> that many people use. Using a variation of the flow I outlined in this article, we can save a html file directly to a SharePoint library, and then use that file\u2019s ID and Path to get the PDF URL of it. Finally, we can use the flow HTTP action to get a hold of that PDF and save it into SharePoint. Neat eh? We don\u2019t need to use OneDrive connector anymore.<\/p>\n<p>So what\u2019s the catch? The main one is the common caveat \u2013 potentially lots of flow runs. Remember that with this method, each time a user clicks a button, a flow run is used to generate the PDF URL. One can improve this by leveraging the fact that we can call the <strong>RenderListDataAsStream<\/strong> API and send it multiple documents to convert to PDF. Thus, a single flow run can actually generate a lot of PDF (and thumbnail) URL\u2019s.<\/p>\n<p>Finally, Ashlee and I <a href=\"https:\/\/youtu.be\/zTyqEEc9-FI\">recorded a video<\/a> of this technique so you can follow along with that over at YouTube.<\/p>\n<p>Phew! We are finally done. Thank for sticking with me and please let us know your feedback and how you plan to utilise this approach. This feedback often gives me ideas and new directions to explore.<\/p>\n<p>Till next time<\/p>\n<p>Paul Culmsee<\/p>\n<p>Company: <a href=\"http:\/\/www.sevensigma.com.au\/\">www.sevensigma.com.au<\/a><\/p>\n<p>Books: <a href=\"http:\/\/www.hereticsguidebooks.com\/\">www.hereticsguidebooks.com<\/a><\/p>\n<p>Blog: <a href=\"http:\/\/www.cleverworkarounds.com\/\">www.cleverworkarounds.com<\/a><\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Imagine a company where service technicians perform on-site repair of equipment. Inevitably, in doing this sort of work, the technician will need to refer to equipment drawings, service history, past photos, specifications and\/or operating manuals.<br \/>\nThese days PowerApps is fast-becoming a great option for such a scenario because many field workers prefer to use their phone or a tablet. But PowerApps also has some limitations, and right now that is around the display of documents from SharePoint. For a start, it is impossible to display office documents natively in PowerApps at this time, and there are authentication-related issues in certain circumstances when pulling content from SharePoint.<\/p>\n<p>But fear not\u2026 with a 6-step flow, it is possible to solve this problem. This flow allows a remote user to securely request a document from SharePoint, but importantly, converts that document to a PDF on the fly. <\/p>\n<p>There are two big benefits from this: <\/p>\n<p>1. A reduction in time and effort for document controllers. If a document frequently changes, it is most likely in word, excel or PowerPoint format. They do not have to worry about converting it to PDF.<\/p>\n<p>2. It allows the document to be viewed in PowerApps natively (As a result of #2, on top of some Flow kung-fu, we will learn some PowerApp tricks in this article too :-).<\/p>\n","protected":false},"author":348,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ms_queue_id":[],"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","_alt_title":"","ms-ems-related-posts":[],"footnotes":""},"audience":[3378],"content-type":[],"job-role":[],"product":[3474],"property":[],"topic":[],"coauthors":[2899],"class_list":["post-110985","post","type-post","status-publish","format-standard","hentry","audience-it-professional","product-power-automate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow - Microsoft Power Platform Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow - Microsoft Power Platform Blog\" \/>\n<meta property=\"og:description\" content=\"Imagine a company where service technicians perform on-site repair of equipment. Inevitably, in doing this sort of work, the technician will need to refer to equipment drawings, service history, past photos, specifications and\/or operating manuals. These days PowerApps is fast-becoming a great option for such a scenario because many field workers prefer to use their phone or a tablet. But PowerApps also has some limitations, and right now that is around the display of documents from SharePoint. For a start, it is impossible to display office documents natively in PowerApps at this time, and there are authentication-related issues in certain circumstances when pulling content from SharePoint. But fear not\u2026 with a 6-step flow, it is possible to solve this problem. This flow allows a remote user to securely request a document from SharePoint, but importantly, converts that document to a PDF on the fly.  There are two big benefits from this:  1. A reduction in time and effort for document controllers. If a document frequently changes, it is most likely in word, excel or PowerPoint format. They do not have to worry about converting it to PDF.  2. It allows the document to be viewed in PowerApps natively (As a result of #2, on top of some Flow kung-fu, we will learn some PowerApp tricks in this article too :-).\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/convert-pdf-with-microsoft-flow-nov-2018\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Power Platform Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-14T13:30:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-11T15:06:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none\" \/>\n<meta name=\"author\" content=\"Jonathon Levesque\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathon Levesque\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"24 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/\"},\"author\":[{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/jonathon-levesque\/\",\"@type\":\"Person\",\"@name\":\"Jonathon Levesque\"}],\"headline\":\"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow\",\"datePublished\":\"2018-11-14T13:30:19+00:00\",\"dateModified\":\"2025-06-11T15:06:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/\"},\"wordCount\":4738,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none\",\"keywords\":[\"Flow of the Week\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/\",\"name\":\"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow - Microsoft Power Platform Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none\",\"datePublished\":\"2018-11-14T13:30:19+00:00\",\"dateModified\":\"2025-06-11T15:06:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage\",\"url\":\"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none\",\"contentUrl\":\"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"name\":\"Microsoft Power Platform Blog\",\"description\":\"Innovate with Business Apps\",\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\",\"name\":\"Microsoft Power Platform Blog\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"width\":194,\"height\":145,\"caption\":\"Microsoft Power Platform Blog\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/person\/017e233f3881f5857f3e7f6f221ef772\",\"name\":\"Jonathon Levesque\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/41fc5b54c4eaedb81f310f27ac37ee7ddeb02a9c5a0fe4616693f664bd6a1d7c?s=96&d=mm&r=g42ef9de3d3e22347884fca1cf41497c5\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/41fc5b54c4eaedb81f310f27ac37ee7ddeb02a9c5a0fe4616693f664bd6a1d7c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/41fc5b54c4eaedb81f310f27ac37ee7ddeb02a9c5a0fe4616693f664bd6a1d7c?s=96&d=mm&r=g\",\"caption\":\"Jonathon Levesque\"},\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/jolevesq\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow - Microsoft Power Platform Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/","og_locale":"en_US","og_type":"article","og_title":"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow - Microsoft Power Platform Blog","og_description":"Imagine a company where service technicians perform on-site repair of equipment. Inevitably, in doing this sort of work, the technician will need to refer to equipment drawings, service history, past photos, specifications and\/or operating manuals. These days PowerApps is fast-becoming a great option for such a scenario because many field workers prefer to use their phone or a tablet. But PowerApps also has some limitations, and right now that is around the display of documents from SharePoint. For a start, it is impossible to display office documents natively in PowerApps at this time, and there are authentication-related issues in certain circumstances when pulling content from SharePoint. But fear not\u2026 with a 6-step flow, it is possible to solve this problem. This flow allows a remote user to securely request a document from SharePoint, but importantly, converts that document to a PDF on the fly.  There are two big benefits from this:  1. A reduction in time and effort for document controllers. If a document frequently changes, it is most likely in word, excel or PowerPoint format. They do not have to worry about converting it to PDF.  2. It allows the document to be viewed in PowerApps natively (As a result of #2, on top of some Flow kung-fu, we will learn some PowerApp tricks in this article too :-).","og_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/convert-pdf-with-microsoft-flow-nov-2018\/","og_site_name":"Microsoft Power Platform Blog","article_published_time":"2018-11-14T13:30:19+00:00","article_modified_time":"2025-06-11T15:06:09+00:00","og_image":[{"url":"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none","type":"","width":"","height":""}],"author":"Jonathon Levesque","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jonathon Levesque","Est. reading time":"24 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#article","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/"},"author":[{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/jonathon-levesque\/","@type":"Person","@name":"Jonathon Levesque"}],"headline":"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow","datePublished":"2018-11-14T13:30:19+00:00","dateModified":"2025-06-11T15:06:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/"},"wordCount":4738,"commentCount":0,"publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage"},"thumbnailUrl":"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none","keywords":["Flow of the Week"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/","name":"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow - Microsoft Power Platform Blog","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage"},"thumbnailUrl":"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none","datePublished":"2018-11-14T13:30:19+00:00","dateModified":"2025-06-11T15:06:09+00:00","breadcrumb":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#primaryimage","url":"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none","contentUrl":"https:\/\/f31j0w.dm.files.1drv.com\/y4mhQL4F-WmHsDvcUlL5TbnZERqsh6TV8X7vy6iiMuxEir02JbE_qseC9DjXBREVym8E-LyZxv255mvQqAeZOc2hva1Yt9hxUzWpdcvKiKJ0H8AK90rCsgAw8wPq-FxZKZRrUt0wki_Cvv5CC6Udh7N6k-QzQBIQftqGIJbzsI3zLKDroO6zgoeGx5UuRS1di7jk2l9R4arwWvDYfQj3Vy9kQ?width=1467&amp;height=290&amp;cropmode=none"},{"@type":"BreadcrumbList","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2018\/11\/14\/convert-pdf-with-microsoft-flow-nov-2018\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/"},{"@type":"ListItem","position":2,"name":"Advanced | Flow of The Week: Convert Office documents to PDF on the fly using Microsoft Flow"}]},{"@type":"WebSite","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","name":"Microsoft Power Platform Blog","description":"Innovate with Business Apps","publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization","name":"Microsoft Power Platform Blog","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","width":194,"height":145,"caption":"Microsoft Power Platform Blog"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/person\/017e233f3881f5857f3e7f6f221ef772","name":"Jonathon Levesque","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/41fc5b54c4eaedb81f310f27ac37ee7ddeb02a9c5a0fe4616693f664bd6a1d7c?s=96&d=mm&r=g42ef9de3d3e22347884fca1cf41497c5","url":"https:\/\/secure.gravatar.com\/avatar\/41fc5b54c4eaedb81f310f27ac37ee7ddeb02a9c5a0fe4616693f664bd6a1d7c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/41fc5b54c4eaedb81f310f27ac37ee7ddeb02a9c5a0fe4616693f664bd6a1d7c?s=96&d=mm&r=g","caption":"Jonathon Levesque"},"url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/jolevesq\/"}]}},"bloginabox_animated_featured_image":null,"bloginabox_display_generated_audio":false,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Power Platform Blog","distributor_original_site_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/110985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/users\/348"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/comments?post=110985"}],"version-history":[{"count":1,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/110985\/revisions"}],"predecessor-version":[{"id":130995,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/110985\/revisions\/130995"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/media?parent=110985"}],"wp:term":[{"taxonomy":"audience","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/audience?post=110985"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/content-type?post=110985"},{"taxonomy":"job-role","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/job-role?post=110985"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/product?post=110985"},{"taxonomy":"property","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/property?post=110985"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/topic?post=110985"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/coauthors?post=110985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}