In previous posts, I have mentioned how much I like using PowerApps and for the advanced IW/part-time entry-level dev, it is a super-powerful platform.
One of the features I have wanted to use is the PDF viewer. Now, you will notice within PowerApps this is listed as an experimental feature. A quick Bing search and you will see that a lot of people have had issues getting the functionality working. Indeed, I myself have had this problem as well, where the only option I had to display my PDF was in a browser, outside of the PowerApp.
Reading the documentation, it is a little ambiguous – it says you need to reference the file via HTTPS then the example shows HTTP. After some testing, this is a working solution and whilst it may not work for all – I am sure it will work for many.
Things You Will Need
Step 1: Save Your File To DropBox
Save your PDF file to dropbox. I used the web version as you will need to share the document to obtain the link. Copy the link to your clipboard
Step 2: Manipulate The Link
You will need to replace the http://www.dropbox.com at the begining of your link to dl.dropbox.com. The rest of the URL can remain the same
Step 3: Add The Code To PowerApps PDF Viewer
In your PDF view, select the Document property. You will need to place the URL you created in Step 2 within quotation (“) marks.
In the example below, I am rendering a boilerplate PDF file:
The PDF file should render nearly instantaneously! The solution can be made even more powerful – if you do not want to hard-code a PDF file, you can leverage a gallery and selected item to retrieve the PDF URL from your source (in my case – SQL Azure; with a field called DropBoxTripReportURL) where you can add the link. Please reach out if you want more details on that solution (or I will blog in the future).