Hello all,
I have a SharePoint List (@Maps) where each item has a "Title" and "Attachments" field. The "Title" field just holds the name of the item (which is in this case, a room), while the "Attachments" field holds 1 PDF file per item.
Inside my PowerApp, I have a screen ('MapsScreen') that has the following code for the Gallery:
When you click on an item inside 'BrowseGallery2', the PDF opens in a different tab (here is the code for the item's OnSelect):
The problem is that even though the image successfully opens in a different tab, it takes a long time to load and our stakeholders would prefer the image pop-up within the app, not in a different tab. They'd like all functions be located within the app, and not externally.
I've tried different code inside the PDF Viewer to show an item's attachment (from the Gallery) when selected, but nothing seems to be working right now. I was confident the following code would do the trick but it's throwing this error. Would anybody be able to help? Thank you!
Solved! Go to Solution.
I actually found an alternate solution. Instead of using a regular SharePoint list to house my pdf files, I created a document library to house them, and then referenced the 'thumbnail' property in an Image control to pull up the PDF file in a popup!
Hi jharville,
You can reference the Attachment using the "Value" property as the Document property of the PDF Viewer.
Document = Gallery3.Selected.Value
Edit: To Clarify:
Gallery 1 (Left) is SharePoint List Items
Gallery 3 (Middle) are attachments
PDF Viewer is referencing the selected Gallery3 Attachment.Value
Hello and thank you for the response @sgtsnacks !
Unfortunately, I think my scenario is different. I don't have 2 separate galleries (1 for the SharePoint list items, and 1 other for solely the attachments). This is why your code under 'Documents' for the PDF Viewer won't work for my PDF Viewer (please see the screenshot below):
After I type in "BrowseGallery2.Selected." ... "Value" isn't a valid attribute to reference.
I only have 1 gallery for that screen, and that gallery houses items from my @Maps - SharePoint list. And each item in my @Maps - SharePoint list has 2 columns: Title & Attachments.
I actually found an alternate solution. Instead of using a regular SharePoint list to house my pdf files, I created a document library to house them, and then referenced the 'thumbnail' property in an Image control to pull up the PDF file in a popup!
@jharville hi , I'm interested to know how you what your alternative solution was. Can please share if you dont mind? Im running into the same issue at this time. thanks
Hi power apps folks,
I have similar issues when the pdf preview only works for myself but not working for other users. I have a flow to run for pdf files but I was aiming to get ride of it since it caused some issues when package into a Solution and extract sometimes doesn't work.
The solution for make all the pdf, word docx, doxt, pdf works. I use a dummy png image file to help get the right file path. then change the image ID to 0.
The key is to create a label, make the label text=Substitute(Substitute(LookUp("SPdocumentlibraryname",ID=the png dummy ID),"image file path,""),"/ID","/0/")
Then add the label text in the PDF Preview Document = If(Last(Split(gallery.selected.Filenamewith extension,".")).Result="pdf", labelname.Text &EncodeUrl(gallery.selected.Folder path & gallery.selected.filenamewith extension),
Substitute(gallery.selected.Thumbnail.Large,"transform/thumbnail","transform/pdf"))
Then hide the labletext field, change visible to false.
This solution works for any user whom has access to this Power App now.
Hope it helps.
Cheers,
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
185 | |
55 | |
43 | |
35 | |
33 |
User | Count |
---|---|
263 | |
78 | |
75 | |
72 | |
67 |