<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Md. Jahidul Islam  on Medium]]></title>
        <description><![CDATA[Stories by Md. Jahidul Islam  on Medium]]></description>
        <link>https://medium.com/@muhammadjahid310?source=rss-27b4ec158f77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bUubDLc1dh1Wy281l0Xiqg.png</url>
            <title>Stories by Md. Jahidul Islam  on Medium</title>
            <link>https://medium.com/@muhammadjahid310?source=rss-27b4ec158f77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 14:02:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muhammadjahid310/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The PowerApps PDF Viewer Drives Everyone Crazy. Here’s the Fix.]]></title>
            <link>https://medium.com/@muhammadjahid310/the-powerapps-pdf-viewer-drives-everyone-crazy-heres-the-fix-e2f8432cb871?source=rss-27b4ec158f77------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2f8432cb871</guid>
            <category><![CDATA[power-autom]]></category>
            <category><![CDATA[sharepoint]]></category>
            <category><![CDATA[powerplatform]]></category>
            <category><![CDATA[powerapps]]></category>
            <category><![CDATA[low-code]]></category>
            <dc:creator><![CDATA[Md. Jahidul Islam ]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 06:36:07 GMT</pubDate>
            <atom:updated>2026-04-14T17:05:20.825Z</atom:updated>
            <content:encoded><![CDATA[<p>No<strong> </strong>Power Automate. No premium connectors. Just a smart formula, and it actually works.</p><p>I’ve seen this happen more times than I can count.</p><p>Someone builds a Power Apps canvas app. They connect it to SharePoint. They upload their PDFs. They drop in the PDF viewer control, because of course they do, it literally says “PDF viewer” and then they click a file.</p><p>Dark screen. Error message. <em>“Couldn’t open PDF file.”</em></p><p>That’s the moment. The moment where most people open a browser tab and start googling “Power Automate PDF flow.” They think they need a flow. They don’t.</p><p>I’m Jahidul. I’ve been building business solutions on the Microsoft Power Platform for years, including canvas apps, SharePoint integrations, automation workflows. And the PDF viewer problem is one of the most common things I see tripping people up. Today I want to show you how to solve it properly, without a single flow.</p><blockquote>Let’s get into it.</blockquote><h3><strong>Why the PDF viewer breaks in the first place</strong></h3><p>Before the fix, the “why” matters. Because once you understand the root cause, the solution makes complete sense, and you’ll never be confused by it again.</p><p>When you store a PDF in SharePoint and connect that library to Power Apps, the link your app receives is not a clean, open HTTPS link to a file. It’s a wrapped, authenticated reference URL. It looks something like this:</p><blockquote><em>appres://datasources/Documents/table/0ec4aaed-59be-483c-b664–29836429166b/rows/35/reference/https%3A%2F%2Fdefault-f4d4ef5f-6ab9–4afd-b8b7–6a24d2351df0.07.common.usa002.azure-apihub.net%2Fapim%2Fsharepointonline…</em></blockquote><p>The <strong>Image control</strong> in Power Apps is fine with this. It uses a different resolution path internally; it knows how to unwrap that reference and pull the file content. It just works.</p><p>The <strong>PDF viewer</strong>? It refuses. Completely.</p><p>It needs a direct, clean HTTPS link pointing straight to a PDF file. No authentication wrappers. No redirects. No HTML views of the document in between.</p><p>And here’s what Microsoft doesn’t say loudly enough: the PDF viewer control (experimental) has five hard limitations built in.</p><ol><li>It only supports PDF files conforming to the <strong>PDF32000 specification</strong></li><li>It only works over HTTP<strong>-</strong>HTTP links will fail</li><li>The Document property must link <strong>directly</strong> to the PDF; no server redirects</li><li>The file must be <strong>accessible anonymously</strong>, without any authentication</li><li>The hosting server must <strong>allow cross-origin requests from powerapps.com</strong> (CORS)</li></ol><p>SharePoint, being SharePoint, runs into limitations 3, 4, and 5 by default. The URLs it generates are authenticated. They redirect. They are not anonymous.</p><p>That’s why the viewer shows a dark screen instead of your document.</p><h3>Buried under a lot of “<strong>use a Flow</strong>” in the Power Apps community talks about</h3><p>You don’t need Power Automate. You don’t need a premium connector. You need to <strong>construct the URL yourself </strong>in the exact format the PDF viewer accepts, and hand it directly to the control.</p><blockquote>Here’s exactly how to do it.</blockquote><h3>Step 1: Set up your SharePoint document library</h3><p>Go to your SharePoint site and navigate to your Documents library. Create a folder for your PDFs, something like <strong>pdfview</strong>, and upload your files there.</p><p>Make sure this library is already added as a data source in your Power Apps canvas app before you continue.</p><h3>Step 2: Add a Hyperlink column called “Link”</h3><p>This is the step most tutorials skip. It’s actually critical.</p><p>In your document library, click <strong>+ Add column</strong>. Name it <strong>Link</strong>. Set the type to <strong>Hyperlink</strong>. Save it.</p><p>Now go to <strong>Settings → Library settings</strong>. Find the <strong>Link</strong> column and click to edit it. Change <strong>&quot;Format URL as&quot;</strong> from <em>Hyperlink</em> to <strong>Picture</strong>.</p><blockquote><em>You can try without changing the format first it works in some environments. But switching to Picture is the reliable setting.</em></blockquote><h3>Step 3: Add the file URL to each document once</h3><p>Select any PDF in your library. In the properties panel on the right side, you’ll see the <strong>Link</strong> field. Paste the direct SharePoint URL to that file into it.</p><p>You only do this once per file. It’s a permanent tag with a clean address for each document that your app can reference later.</p><h3>Step 4: Back in Power Apps, add a Gallery and a Label</h3><p>In your canvas app, insert a <strong>Gallery</strong> and connect it to your SharePoint document library. Name the gallery <strong>galPDF</strong>.</p><p>Now add a <strong>Label</strong> anywhere on the screen. Set its text property to:</p><blockquote>galPDF.Selected.Link</blockquote><p>Select a file in the gallery. The label will show you a long, encoded URL, something starting with appres://datasources/Documents/table/…</p><p><strong>Copy that entire URL.</strong> Everything from <strong>appres://</strong> right through to <strong>/reference/</strong> at the end. You&#39;ll need that specific string in the next step.</p><h3>Step 5: The formula that makes everything work</h3><p>This is the heart of the solution.</p><p>On your <strong>PDF Viewer control</strong>, set the <strong>Document</strong> property to the following formula. Replace the long <strong>appres:// </strong>string with the one you just copied from your own label.</p><p>If(Last( Split( galPDF.Selected.’File name with extension’, “.” ) ).Value = “pdf”, “appres://datasources/Documents/table/YOUR-TABLE-ID/rows/35/reference/” &amp; EncodeUrl( galPDF.Selected.’Folder path’ &amp; galPDF.Selected.’File name with extension’ ), Substitute( galPDF.Selected.Thumbnail.Large, “/thumbnail”, “/pdf” ) )</p><blockquote><strong>Important note on .value vs .result :</strong> Depending on your Power Apps version, the Last(Split(…)) function may return .value or .result . If the formula gives you an error, swap .value for .result and it will fix itself.</blockquote><p>Let me break down what this formula is doing, because it’s worth understanding:</p><p><strong>The if(…) check.</strong> First, it looks at the selected file&#39;s name and splits it by the <strong>. </strong>character. Then it takes the last piece (the extension) and checks if it equals <strong>PDF</strong>. This ensures the formula only tries to build a PDF link for actual PDF files.</p><p><strong>The “appres://…” &amp; EncodeUrl(…)</strong> <strong>branch.</strong> If the file is a PDF, it constructs a proper HTTPS-resolvable link. The <strong>appress://</strong> string is your environment&#39;s base connector URL. The <strong>EncodeUrl </strong>function safely encodes the folder path and filename so special characters (spaces, symbols) don&#39;t break the URL. The result is a direct, clean link the PDF viewer can actually open.</p><p><strong>The Substitute(…) fallback. </strong>If the file is <em>not</em> a PDF, it falls back to a clever trick. SharePoint generates thumbnail URLs for all documents. Those URLs follow a predictable pattern ending in /thumbnail. By replacing that segment with /pdf, we hit the same endpoint but request the PDF render instead. Clean. No extra calls.</p><h3>What you get at the end</h3><p>Two views, side by side.</p><p>On the left, the <strong>Image view</strong>. A thumbnail preview of your document, rendered through the Image control.</p><p>On the right, the <strong>PDF view</strong>. The actual full document, scrollable and interactive inside your app. If the PDF contains fillable form fields, users can edit them right there; there&#39;s no need to open anything externally.</p><p>No flow ran. No connector made an API call. Just a URL constructed at the formula level, handed directly to the control that needed it.</p><h3>Visual walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vh_4eAtg1NblGd6qSbaVHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sy4OgPY68oxMFUU6go3CUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7rDRLttu_mFUTpU_RIZu4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Ns65LB28Q0thEMqJKpc1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5G7oUwMnWCmkIAYsk8tjEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CuZhld4MrH_5wLFzWfUzwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3RpJJbGiONZTv5ME1ZMSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*96Z3ZEhP_hC4wTh0_En3ig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r9nd7_-Z9q2SDKw3u3DJng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cjk43bwYS9v8-gr83e5HPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AdaM25T42iwJM2lboTpjIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ajl4kKYJpvQH-Y1-OHxbWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BO4mkcDrcFSCxauorkXeMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eZ1H9wWaQWB2MiMqjhadjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yab5KreL2bDOrfYieqSRQQ.png" /></figure><h3>Three mistakes people make with this approach</h3><p>Before you go off and build, let me save you some debugging time.</p><p><strong>Mistake 1: Copying the wrong part of the appres URL.</strong> <br>You need everything from up to and including /reference/. Don&#39;t include the encoded file path that comes after the EncodeUrl() part of the formula, which generates that dynamically for each file.</p><p><strong>Mistake 2: Forgetting to add the Link column value for new files.</strong> <br>This approach requires you to manually paste the SharePoint URL into the <strong>Link</strong> column once per file. If you add new PDFs to the library and forget this step, the viewer will show nothing for those files. Make it a habit when uploading.</p><p><strong>Mistake 3: Using </strong><strong>.Value when your environment needs </strong><strong>.Result (or vice versa).</strong> <br>The Last(Split(…)) function changed its return property in certain Power Apps versions. If the formula shows a red error immediately, just swap .Value to .Result . One second fix.</p><h3>Why this matters beyond just PDFs</h3><p>Power Automate flows are powerful. I use them constantly. But they add latency, licensing overhead, and extra failure points to your app. For something as simple as rendering a file, they’re overkill.</p><p>More importantly, once you understand <em>why</em> the original approach failed, you start recognizing the same pattern everywhere in Power Apps. A lot of “why doesn’t this work” questions on community forums come down to one root cause: a control needed a direct HTTPS URL and got an authenticated wrapper instead.</p><p>This formula is just you taking control of that translation yourself.</p><p>The PDF viewer isn’t broken. It just needs the right input. Now you know how to give it one.</p><blockquote>If this saved you from building an unnecessary flow, clap or drop a comment, it genuinely helps. And if you’re working with Power Apps and SharePoint regularly, follow along. There’s more of this kind of thing coming.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2f8432cb871" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>