cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

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
Highlighted
Power Apps
Power Apps

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
Highlighted
Power Apps
Power Apps

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!

Highlighted
Anonymous
Not applicable

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?

Highlighted
Anonymous
Not applicable

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?

Highlighted
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! 

 

Highlighted
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? 

Highlighted
Power Apps
Power Apps

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,946)