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

Trying to Display Image and PDF

I've been using the following to force Power Apps to end all update files with .jpg.

 

This works great if user are only uploading new 'image' files.


Unfortunately, I've inherited thousands of pdf files that the client wants the ability to display in Power Apps

 

Also, most Users have these documents in pdf and don't have license to a version of pdf in which they can convert those files to an image files; and would probably insist that they should be able to upload either.

I currently have the following in my submit button for new items being upload to the SP library. It works fine for image files; however, pdf files (for reason I already know) do not display. I'm going to add an pdf view control to see if it solves my problem.

 

If I remove the & ".jpg" from the below does that mean all files will upload with whatever file format tag they were created/saved in? I need the field formatting because hundreds of uses will name their files whatever they like; this manages that. How do I ensure both image and pdf can be uploaded to the library and retrieved and viewed again in a Power Apps Gallery.

 

I can already see the image files. Will removing the .jpg and adding the pdf control and a Gallery with a 'ThisItem' control get me my pdf file to the screen?

 

3csman_0-1613612046045.png

 

8 REPLIES 8
v-bofeng-msft
Community Support
Community Support

Hi @Anonymous :

Q1:If I remove the & ".jpg" from the below does that mean all files will upload with whatever file format tag they were created/saved in? 

A:If you remove ".jpg", I am afraid you will not be able to guarantee that the files uploaded by users to the SP library will be created in the correct format.If you are worried about this, you can create a dropdown to let users choose the file format.

Q2:Will removing the .jpg and adding the pdf control and a Gallery with a 'ThisItem' control get me my pdf file to the screen?

A:Sorry, I can't understand what you mean. Could you provide some screenshots and additional instructions?

Best Regards,

Bof

 

Anonymous
Not applicable

 

The below Gallery displays images of documents desired to be viewed in the user interface based on the name of the Cert/Qual Title.

 

This process, as you can see with the test image below, works fine as long as the item coming from the library is an 'image' file. If the member has uploaded a pdf version of the document no image displays in the image control.

 

How do I get a pdf to display in the Gallery? I am of the understanding a pdf file cannot be displayed in an image control.

 

3csman_0-1613664988206.png

 

The language used to upload items to the library is -

3csman_2-1613665291639.png

 

The language being used to  return the images from the library is -

3csman_1-1613665232671.png

 

Hi @Anonymous :

I noticed that you have obtained the thumbnails of the files in the library.

2.JPG

I have tested that ,the thumbnails of the PDF files can be displayed in the image control.

1.JPG

In addition, I also did a test, the PDFViewer can not be put in the Gallery, so I am afraid there is no other way besides using thumbnails.

Best Regards,

Bof

Anonymous
Not applicable

1. Because of my condition and my flow all of the uploaded document are uploaded and .jpg.

 

2. I see in your example you have pdf and xlsx. How are you able to upload the different files types.

 

3. What is the format of your Gallery Condition is it just the name of the library and you get everything? That won't work for this purpose. The current Gallery fields, including the Image control are being populated by a variable (varIsCQRecord) so that the Gallery only populates the records associated with the User. 

Hi @Anonymous :

1. Because of my condition and my flow all of the uploaded document are uploaded and .jpg.

If your file has been uploaded to the library, I suggest you can go directly to the library to find the thumbnail as the image property of the image control.

2. I see in your example you have pdf and xlsx. How are you able to upload the different files types.

This is just a template for testing. If you want to know how to upload different types of documents to a library, I think this should be another thread.

3.What is the format of your Gallery Condition is it just the name of the library and you get everything? That won't work for this purpose. The current Gallery fields, including the Image control are being populated by a variable (varIsCQRecord) so that the Gallery only populates the records associated with the User. 

I haven't found any description of varIsCQRecord from your post before.Could you tell me how it is defined? As of now, I still don’t understand your situation well. If you need further help or help from other volunteers in the forum, I suggest you elaborate on your situation in an orderly manner.My suggestion at the moment is that you could go directly to the library to find the thumbnail as the image property of the image control.

Best Regards,

Bof

Anonymous
Not applicable

Okay; let's skip the variable.

 

I went straight the the library using a new Gallery. All of the image files appear. The two pdf files the 'I LITERALLY'  just uploaded do no appear in the image control. Here is an example. The first item is a previously uploaded .jpg file. The second item I just uploaded to the library; it was a .pdf file.

 

I have the following in the Gallery Items to filter for most recent and only items associated with the User, not the entire list or library:

 

SortByColumns( ForAll( Filter( Distinct( Filter(MemberCertsandQualsList, FullNm=MemberProfileFullNmDropdown.Selected.FullNm ), CQTitle ), !IsBlank(Result) ), With({_filterData: AddColumns( Filter( MemberCertsandQualsList, CQTitle=Result && (DteofCQ>=MemberProfileDatePicker1.SelectedDate) && (DteofCQ<=MemberProfileDatePicker2.SelectedDate) && FullNm=MemberProfileFullNmDropdown.Selected.FullNm ), "stat", If(ComplianceStatus="Noncompliant", 0, 1) ) }, First( Sort(_filterData, DteofCQ, Descending ) ) ) ), "stat", Ascending )

 

3csman_0-1613705651920.png

I get this error when I click on the empty image where the pdf should appear.

 

{"error":{
  "code": "generalException",
  "message": "Substitution Stream found in slot (Original Time: 2021-02-19 03:30:00Z. Format not supported: additional info, e3676f9a-a7d",
  "innererror": {
    "code": "SubStreamCached_FormatNotSupported"
  }
}}

 

I have the following in the image property of the Image control inside the Gallery:

 

With({_common: ThisItem.CQYr & " " & ThisItem.UnqID & " " & ThisItem.CQTitle & " " & ThisItem.FrstNm & " " & ThisItem.LstNm}, Coalesce( LookUp(CQImageCollection, StartsWith(Title, _common & " " & ThisItem.DteofCQ)), LookUp(CQImageCollection, StartsWith(Title, _common)) ) ).'Thumbnail ({Thumbnail})'.Large

 

I am using the following (along with the Flow, set to 'UploadedCertsandQuals' List; Content.FileName and Content.FileContent. It is my belief that something in the following is causing my file read error; such as forcing the name of the file, even a pdf file, to include .jpg. It seems to work fine on all the image type file. But I'm not sure. 

 

3csman_1-1613705965316.png

 

Here are the files in the library. As you can see the image file (Arrowhead) shows fine in the Thumbnail.

 

The pdf file (items 2 and 3) do not show any image.

3csman_2-1613706515806.png

 

 

Everything works except the display of the .pdf file.

 

 

Hi @Anonymous :

1.JPG

I noticed that the suffixes of your "PDF" files are all ".jpg", can you check whether these "PDF" files can be opened normally?Are they still "PDF" files?

I suggest you use dynamic suffix when creating files by flow, don’t just use ".jpg" as the suffix.

I think this link will help you a lot:

PowerApps Upload File to SharePoint Library 

Best Regards,

Bof

Anonymous
Not applicable

Before I get started, my review of the content on the link appear to NOT focus on the file naming convention of the uploaded documents. It is important the naming convention be controlled and the same for each file uploaded. This is why chose the below method. Is there a way to include this naming convention in the 'dynamic' design in the Flow without the .jpg. Can the List column/field names be added in the Flow so that it matches the below out file creation in the library?

3csman_0-1613747926060.png

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,765)