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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / pdfviewer wont display...
Power Apps
Answered

pdfviewer wont display if document (name) property is a variable

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

The pdf file  ('Staff Handbook') is held in the media library within the app. 

If i type

'Staff Handbook' (including the quotes)

into the document property of pdfviewer it displays just fine.

However if I pass a variable "viewdoc" which is 'Staff Handbook'  to the document property which equates to 'staff handbook',

such as

"'" & viewdoc & "'"

(or even viewdoc)

I get "could not open pdf file"  error.

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

    @Anonymous 

    Yes, this will be the case with the internal media library.  Once you import media, it is given a name and is considered an object in the app.

    You cannot reference objects by a string name (for any object in PowerApps).

     

    However, variables can reference objects.

    So, if you set your variable like this:  Set(viewdoc, 'Staff Handbook') and then use that in the PDF document property, it will display.  The reason is, your viewdoc variable in this case is NOT a text variable, it is now considered an object variable.

     

    I hope this is helpful for you.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This is MOST helpful. Truth be told I had just found out about the "issue" after searching "media" rather than "pdfviewer". However I had not found a solution.

    My app now works (again). 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,041

#2
11manish Profile Picture

11manish 676

#3
Valantis Profile Picture

Valantis 655

Last 30 days Overall leaderboard