web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / View a specific pdf fi...
Power Apps
Unanswered

View a specific pdf file from sharepoint library in powerapps

(1) ShareShare
ReportReport
Posted on by 6
Trying to set by clicking on a button of page 1 in powerapps, it would like to the pdf file opening in yhe next page under PDF viewer. That specific file are store in sharepoint document library.

Anyone would be able to shed some insight om how that can be done? Thank you.
Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    on at

    Hi @CuriousJ ,

    Do you want to preview the PDF files stored in your SP Library?

     

    If you want to preview the PDF files stored in your SP Library, I afraid that there is no direct way to achieve your needs in PowerApps currently. The PDF Files (or any other files) stored in a SP Library is required to authenticate, but if you want to preview PDF files in PDF Viewer control, the server that hosts the document must not require authentication.

    Please check the limits in PDF Viewer control, please check the following article:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-pdf-viewer#limitations

     

    As an alternative solution, I think the combination of PowerApps and MS Flow could achieve your needs. Please check and see if the following blog and video resources would help in your scenario:

    https://masteroffice365.com/viewing-pdfs-from-sharepoint-within-powerapps/

    https://www.youtube.com/watch?v=NTp77benqfQ

     

    Please take a try with above solution, then check if it could help in your scenario.

     

    Best regards,

  • v-xida-msft Profile Picture
    on at

    Hi @CuriousJ ,

    Please go to your flow's history, then check if the flow returns a proper PDF File content back to your app.

     

    Best regards,

  • Office365Master Profile Picture
    338 on at

    @v-xida-msft 

     

    I wrote that blog and I am curious how many App Makers out there tried the "hack" I used asa for me at least it appeared to work consistantly well with any PDF document I wanted to view based on that Flow.

     

    Having said that, subsequent to writing that blog I have been working on an "awesome" demo app that amongst many other things demostrates a technique to view any PDF document in SharePoint in 100% totally supported ZERO HACK method <grin> by running a single Flow not multiple times for say each PDF document in a folder in a Document Library but just once for all PDF documents in that single folder. Based on the technique I leveraged in my upcoming blog, my personal personal opinion is that PowerApps team may well finally have a fully supported method to finally enable this functionality natively within PowerApps (if they not already working on it...).

     

    A few weeks ago I posted a teaser / prototype demo of the type of functionality this demo app implemented with just one screen can do:

    https://youtu.be/WkAw6QCbcKk

     

    Watch this space - within the next 2 weeks latest.

     

  • Office365Master Profile Picture
    338 on at

    Hi @CuriousJ,

     

    Further to checking if the Flow did successfully run, should you find it didn't even attempt to run, I'd suggest removing that Flow from the app and then add it again and test again.

     

    Please share your findings, perhaps I can help further with more details. 

     

    Regards,

    Brian

  • Office365Master Profile Picture
    338 on at

    Based on your screenshots it would appear the problem lies in your PowerApp and not with the Flow. I'd also suspect that there is nothing wrong with any of your code on the second screen.

     

    I'll need to retest the code because the way in which I populated the rows in my own gallery was actually using a Flow that returned the "._dlc_DocIdUrl_Description" property of the document. In which case in the next couple of days I'll update that blog in the next few days that details the first Flow I used to populate my Gallery with the PDF documents stored on your SharePoint Library...  

  • Verified answer
    Office365Master Profile Picture
    338 on at

    @CuriousJ wrote:
    Hi Brian,
    I have below error when adding the variables to powerapps. Not too sure where I did wrongly. Pretty new to the powerapps and flow. Maybe you could share some insight. Thanks.

    I have correct the code in OnVisible property on the second screen in the app as it should have actually referenced the original document file name and not "._dlc_DocIdUrl_Description" (my bad Smiley Frustrated). 

    The correct code for the OnVisible property should in fact be as follows:

    UpdateContext({ loading_v: true });
    UpdateContext({
       pdf_v:  'PowerApps-GetPDFdocument'.Run(
                   Concatenate( First( Split( selecteditem_v.Name, ".") ).Result, ".pdf")
                   )

     });
    UpdateContext({ loading_v: false })

    The purpose of the "Split" function used in the code above is to remove the file name extension of the original document name and thereaafter replace it with a ".pdf" file extension name.

    Hope that solves the issue you were experiencing.
    I have updated that blog with the correct code as well.

  • CuriousJ Profile Picture
    6 on at
    Thanks Brian!
    It's working perfectly now. 🙂
  • MasterOffice365 Profile Picture
    184 on at

    Other alternate ways 😁

     

    This following one statement in the Document property on a PDF Viewer control will dynamically convert many document types to PDF you can display in your apps such as Word documents, PowerPoint presentations, HTML files. Loads more.

    Substitute( Gallery1.Selected.Thumbnail, "transform/thumbnail", "transform/pdf" )

     

    There is a more consistent way of doing it with PDF documents using the Graph APIs which surface a "@content.downloadUrl" property for any file, but this property in particular works 100% of the time, and once again you only need to set the Document property on the PDF Viewer to this field using the PA_Graph_DriveItems Flow I've shared on a really long blogs that speaks to loads more things you equally do using those APIs. 

     

    Rather download the simplified version of demo app I've shared on that blog, and all the other Flows if you want to:

    https://youtu.be/poKsDNYm9Jw

    https://masteroffice365.com/powerapps/9/#DownloadSolution

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard