cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jvaughan
Level: Powered On

View PDF Files

Hi, 

 

I need some help. 

 

I am wanting to create a page with a Drop down menu on which list's our employees.

 

once you select a employee a series of PDF's open in a gallery or something like that. 

 

If this does not work with PDF's I am more than happy to do it with JPG files

 

hope you understand what I am asking and hope someone can help

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff miglisic
PowerApps Staff

Re: View PDF Files

Hi all. PDF Viewer control only supports loading PDF files included as a resource of the app, or ones available on a public URL that has sufficiently permissive cross-origin configuration, HTTPS access, and no auth requirements.

 

Please see "Limitations" in the control reference:

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

 

I hope this helps clear things up.

 

 

View solution in original post

6 REPLIES 6
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: View PDF Files

PowerApps does have support to show PDF files. For your scenario, I'll assume that you have the data about the employees and the PDF documents that you want to show in a table, like in the example below (here I have an Excel file with a table called 'Documents', but other data sources would work the same)

ForumPost000.PNG

If I understand you correctly, you want an app that looks somewhat like this:

ForumPost001.PNG

Where when you select the employee in the dropdown (top-left), it will update the list of PDFs associated with that employee (bottom-left), and then you can choose a document that will be displayed (right). Here are the formulas that you can use to create this app.

 

For the dropdown, you want to select the employee names, so you can use the Distinct function to list the employees:

Dropdown1.Items: Distinct(Documents, Employee)

Now in the gallery we can filter the Documents data source to show only those that are related to the selected employee. And in the text box inside the gallery we list the document's topic. I'm also updating the TemplateFill property of the gallery to highlight the selected item, to make it easier for the user to see which document is being displayed.

Gallery1.Items: Filter(Documents, Employee = Dropdown1.Selected.Value)
Gallery1.TemplateFill: RGBA(0, 0, 0, If(ThisItem.IsSelected, 0.2, 0.1))
TextBox1.Text: ThisItem.Topic

Finally, we can use a PDF Viewer control, and bind its Document property to the selected item in the gallery:

PdfViewer1.Document: Gallery1.Selected.URL

Hope this helps!

Jvaughan
Level: Powered On

Re: View PDF Files

Hi Thanks, This is exactly what I was looking for but for some reason when I try it out the PDF view is just all greyed out?

Jvaughan
Level: Powered On

Re: View PDF Files


@CarlosFigueira wrote:

PowerApps does have support to show PDF files. For your scenario, I'll assume that you have the data about the employees and the PDF documents that you want to show in a table, like in the example below (here I have an Excel file with a table called 'Documents', but other data sources would work the same)

ForumPost000.PNG

If I understand you correctly, you want an app that looks somewhat like this:

ForumPost001.PNG

Where when you select the employee in the dropdown (top-left), it will update the list of PDFs associated with that employee (bottom-left), and then you can choose a document that will be displayed (right). Here are the formulas that you can use to create this app.

 

For the dropdown, you want to select the employee names, so you can use the Distinct function to list the employees:

Dropdown1.Items: Distinct(Documents, Employee)

Now in the gallery we can filter the Documents data source to show only those that are related to the selected employee. And in the text box inside the gallery we list the document's topic. I'm also updating the TemplateFill property of the gallery to highlight the selected item, to make it easier for the user to see which document is being displayed.

Gallery1.Items: Filter(Documents, Employee = Dropdown1.Selected.Value)
Gallery1.TemplateFill: RGBA(0, 0, 0, If(ThisItem.IsSelected, 0.2, 0.1))
TextBox1.Text: ThisItem.Topic

Finally, we can use a PDF Viewer control, and bind its Document property to the selected item in the gallery:

PdfViewer1.Document: Gallery1.Selected.URL

Hope this helps!


Hello, 

 

This works great but I have changed it a little bit. 

 

instead of using PDF's I have use JPG's and another Gallery instead of the PDFviewer. 

 

The reason I have done this is because When using a PDFviewer I can't seem to get the PDF's that are linked from my onedrive to show. But I am able to do it with JPG's.

 

But I have come across another small problem. 

 

Basically when editing the App I can see the JPG files when selecting which file to view.... But when I test the app the Jpgs will not load? 

 

Have i done something wrong?

Anonymous
Not applicable

Re: View PDF Files

This is so great and would be an amazing feature, if only you could use it to display PDFs stored on OneDrive or more specifically, SharePoint. 

 

You are able to get to a point of entering the correct formula for the file, but it just renders the pdf as a grey block.

 

That is so truly dissappointing....I hope MS choose to support that feature using the pdf viewer soon! 

 

Anonymous
Not applicable

Re: View PDF Files

Sorry to lazarus this thread, but I came up with a workaround to the pdf viewer issue (pdf viewer not working with files stored on SharePoint or OneDrive) which involved adding the pdf document library as a data source and loading the meta data into the app. Then using the ThisItem.{link} to launch the document. This was working perfectly on Android and iOS until the end of last year when suddenly attempting to open the file generated and error stating Connot display PDF ( Filename.pdf cannot be opened). Anyone got any idea why this would be? 

PowerApps Staff miglisic
PowerApps Staff

Re: View PDF Files

Hi all. PDF Viewer control only supports loading PDF files included as a resource of the app, or ones available on a public URL that has sufficiently permissive cross-origin configuration, HTTPS access, and no auth requirements.

 

Please see "Limitations" in the control reference:

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

 

I hope this helps clear things up.

 

 

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 405 members 2,817 guests
Please welcome our newest community members: