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 / PDFviewer - Displaying...
Power Apps
Answered

PDFviewer - Displaying a PDF stored on SharePoint or OneDrive

(0) ShareShare
ReportReport
Posted on by 142

Over the summer I built an app that was easily able to display a PDF stored either on OneDrive or SharePoint by creating an app that loaded the file as a blob into a Context Variable as a Blob.  It worked perfectly by referring to the context variable PDFviewer1.jpg

PDFviewer2.jpg

Many months later, I am trying to use that technique and it isn't working.  Does anyone know if support for this technique is no longer available?  The file is stored on my OneDrive and this should be simple.

 

Thanks,

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @markslosberg 

    What is your formula for defining the pdfobject variable?

  • MS-22072102-0 Profile Picture
    142 on at

    Here is the OnSelect code that runs on this button

    UpdateContext(
     {
     pdfobject: 'CreateWordPDFQuote-outsideofsolution'.Run(
     "FGSO-1143",
     "testfilefromAppOutsideSolution"
     )
     }
    )

    Here is the Flow that is called (all that is missing is the initial PowerApp Init step).

    markslosberg_0-1610052707156.png

     

    And here is the money steps at the end expanded (ignore the pdfURL - that is just and experiment that isn't working)but everything else is correct.

    markslosberg_1-1610052898605.png

    Here is context variable in PowerApps

    markslosberg_2-1610052983663.png

    And here is the contents of pdfobject after I run the flow.

    markslosberg_3-1610053028911.png

    Here is the OneDrive folder that contains the file:

    markslosberg_4-1610053269277.png

    And here is a sample PDF quote that I am generating:

    markslosberg_5-1610053396695.png

     

    As I said, I had this design pattern working perfectly over the summer and now that I actually need it to work as a "last mile" feature, I am stymied.

     

    Thanks for your help.

     

  • Verified answer
    MS-22072102-0 Profile Picture
    142 on at

    I gave up for the moment although I have enlisted the help of a variety of Microsoft resources including the support channel and others in the product team to answer the central question of how to correctly display a PDF stored in OneDrive in the PDFViewer control.

     

    I developed a workaround by:

    1. adding a field of type "File" to the CDS entity - (you may note that there is now an Image type field too.  I tried that and it didn't work.  I just haven't deleted it yet;-). markslosberg_2-1610174236978.png
    2. adding a step in the Flow that creates the PDF to upload the "file content" of the CreatePDFfromWordDoc flow step to the new CDS field. 
       
       
       
       
      image.png

       

    3. Then I was able to successfully refer to that selected record from the record selected from a gallery pointed to the CDS entity.  By using the .Value from the selected record/field as the input to the Document parameter in the PDF Viewer, I got it to correctly display the PDF.  markslosberg_1-1610174063989.png

    Definitely "going around the block to get next door" but in the end it is probably a better design and will minimize runaway "intermediate" or dated versions of the printed document accumulating in the OneDrive folder. 

     

    I don't have time to solve the original question as it stands which remains, "can one display a PDF stored in a OneDrive or SharePoint Document library in a PDFViewer control?"  I just don't know but hopefully, someone with deep product knowledge can answer that question.  In the meantime, I have an effective workaround, and perhaps a better overall design.

    I probably could have also gotten an Azure Storage account and used it to store the PDF temporarily to display it but that would be even clunkier and heavy-handed, plus my client hasn't committed to any Azure usage so far so that would have meant a lot of other lengthy discussions that I wanted to avoid.

     

    My only fear is that I have been using the PDFViewer control now for just about 4 years and it is still classified as "Experimental" image.png. This approach, syntax and usage is not sanctioned in the documentationimage.png 

    as a supported input to the Document property.  That states that the input to the Document property of the PDFViewer control is supposed to be only a direct https:// link to an unsecured URL with no redirects.  I worry that 6 months ago from now something will change and suddenly this won't work then like my solution from 6 months ago doesn't work now but I will cross that bridge when I get to it.  In the meantime, this looks like a pretty stable workaround but we will see as we test it with some 100 users or so.

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard