I have a sharepoint list which may have multiple attachments associated with each item. Among these attachments, there will *always* be one for each item which will be useful for people in the field to view. I created a screen which displays some meta data and all attachments associated with the list item. However, I would like the user to either be able to select one of these and view it, or simply view the pdf that will be useful to people in the field (selection of the correct pdf attachment could be controlled by the name of the pdf perhaps?). There does not seem to be a 'onSelect' option for the attachments in the form that displays them.
How can I use pdfViewer to view a pdf attached to an item in a list?
Solved! Go to Solution.
Hi @akorejwa ,
I've afraid it's not supported to make this currently in PowerApps.
For now, you could only set the PDF viewer's Document to the PDF's link directly.Server redirects or HTML views of the document aren't supported. For example, set the Document to Gallery2.Selected.AbsoluteUri, it will not display PDF successsfully.
Here's a doc about PDF viewer for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-pdf-viewer
As an alternative way, I suggest you use the Lunch function.
Set the gallery's arrow's OnSelect: Launch(ThisItem.AbsoluteUri)
Then, if user click on the arrow, it will open PDF file in webpage automatically.
Best regards,
Community Support Team _ Phoebe Liu
Hi @akorejwa ,
I've afraid it's not supported to make this currently in PowerApps.
For now, you could only set the PDF viewer's Document to the PDF's link directly.Server redirects or HTML views of the document aren't supported. For example, set the Document to Gallery2.Selected.AbsoluteUri, it will not display PDF successsfully.
Here's a doc about PDF viewer for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-pdf-viewer
As an alternative way, I suggest you use the Lunch function.
Set the gallery's arrow's OnSelect: Launch(ThisItem.AbsoluteUri)
Then, if user click on the arrow, it will open PDF file in webpage automatically.
Best regards,
Community Support Team _ Phoebe Liu
Hi @v-yutliu-msft ,
I'm new to power apps and I try to create an app based on some shp lists.
I have a shp list named receptions and it contains info about invoice details and product detalis and I also add pdf file to attachments column. On my screen I have a data table showing the info from my list, a gallery and a pdf viewer.
What I want, if it is possible is if the user click on a data table row, pdf viewer should show the attachment it has. Even now I didn't find it how to do this, and I tried using a gallery. I've done what you said but it seems there is an error and I don't know how to solve it.
As you can see, the word AbsoluteUri is underlined with red. Same with pdf viewer Document propriety
What am I missing.
Please keep in mind I am a total noob in this so a tutorial on how to work this out is greatly appreciated.
Thank you!
@v-yutliu-msft , I think I found a way but it didn't fix my problem
I corrected the formula, and now it's working but it doesn't open into my pdf viewer but it opens a new tab in chrome showing the attachment. See image bellow
Please help thanks !
First(Gallery1.Selected.Attachments).Value
First(Gallery1.Selected.Attachments).Value
I will take this one step further. In your case what Pramud said will work best, however, I have a solution that will allow you to select the PDF that you want to be shown, with the first one in list always showing by default.
1. Create your Gallery1 and Set the "On Select" to Set(SelectAttach,true)
2. Create a second Gallery2 in the middle of the Page or where ever you want. Set its visible property to the SelectAttach variable. Set it's OnSelect property to Set(SelectAttach,false)
3. This is the cool part. Since the attachments column in a Sharepoint list is also it's own table, it can be used as a Gallery's source. So set the Item property of Gallery2 to Gallery1.Selected.Attachments
4. Create a Label inside Gallery2 and Set its field to the DisplayName (it may already do this automatically by default when the label is added). Optional - create a button overlay so the finger pointer appears.
5. Now all that is left is set the PdfViewer's Document property to Gallery2.Selected.Value
This will make it so that when you select something in Gallery1, a "Popup" will appear that will show you a list of the attachments associated with the item selected in Gallery1. When you select the attachment, it will close the "Popup" windows and display the document in the PDFviewer. Pretty neat huh?
User | Count |
---|---|
253 | |
113 | |
92 | |
48 | |
38 |