cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KrishnaV
Super User
Super User

Not able to render PDF in PowerApps PDF Viewer control

Hi Team,

 

I am trying to render a PDF file from my SharePoint library (from the same tenant and the user has complete access) but what I see using the PDF Viewer is as below 🙄.

 

However, I can render the PDF if I update into media as "ExpenseReport.jpg" but the user wants to select the file dynamically.

https://<<Tenant-Name>>/sites/Practice/Shared%20Documents/ExpenseReport.pdf?csf=1&web=1&e=Iqp572

 

PDF Error.png

Please help if anyone see the same issue.

 

Regards,

Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @KrishnaV ,

You are using a different process (not the address - that is the same) for the content return. I use Get File Content Using Path and then simply use an Expression to retrieve it body('GetPDF')['$content'] (referring to the name I have given the previous step)

PDFFlow2.png

I am no Flow expert and I am not sure of the difference (if any) with Get File Content, but you have a Compose action in yours which I suspect may be the issue.

PDF Error_2.png

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @KrishnaV ,

Sorry but the process is not that simple - I have a couple of apps that use this facility - my process is as follows

Firstly at App OnStart, set a Variable to the base address of your site and folder path.

Set(
   stSite,
   "https://xxxxxx.sharepoint.com/sites/xxxxxx"
);
Set(
   stFolder,
   "xxxxxxx/"   //your folder path
)

Make a Flow (mine is PDFView) that does this.

 

PDFView.png

 

 

 

 

 

 

 

 

 

 

 

 

 

This bit is actually from a gallery of PDF files - you can adapt it

Set(
   stPDFName,
   ThisItem.DocName
);
Set(
   ViewPDF,
   PDFView.Run(
      stSite,
      Concatenate(
         "/",
         stFolder,
         First(
            Split(
                stPDFName,
                "."
            )
         ).Result,
         ".pdf"
      )
   )
)

Finally the Document in your PDF viewer will be

ViewPDF.pdf

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi Warren,

 

Thank you very much, I will certainly try this and let you know my output.

 

Regards,

Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi Warren,

 

Thank you for your support and sincere apologies for the late response. I am not able to get through the issue and I see the below error:

{
  "error": {
    "code"301,
    "source""unitedstates-002.azure-apim.net",
    "clientRequestId""3595b837-3489-47e8-a06d-4835e1026fe0",
    "message""The response is not in a JSON format.",
    "innerError""Cannot read server response."
  }
}
 

I just made the flow as manual and want to ensure that it is working fine before I try through PowerAPP.

 

Thank you,

Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
WarrenBelz
Super User
Super User

Hi @KrishnaV ,

You are using a different process (not the address - that is the same) for the content return. I use Get File Content Using Path and then simply use an Expression to retrieve it body('GetPDF')['$content'] (referring to the name I have given the previous step)

PDFFlow2.png

I am no Flow expert and I am not sure of the difference (if any) with Get File Content, but you have a Compose action in yours which I suspect may be the issue.

PDF Error_2.png

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi Warren,

 

Thank you for your time now I can see the data in PowerApps with PDF viewer only mistake I was doing is at the return to PowerApps step I am just sending body('GetPDF') now I updated it with an expression as body('GetPDF')['$content'].

 

 

 

Thank you once again to make my weekend with a happy closing 😎.

 

Regards,

Krishna 

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi, im trying to use Your code and i still cant see any PDF in the PDF VIewer. 

 

In the flow, "Return to Power apps" the result is: (only the first line)

 

return.png

 

But when i look at the variable, "ViewPDF" after i run the Flow, i see that is empty.  There is nothing in the variable. 

 

ANy idea what can be wrong ?

@TrulsBj1 ,

This is a closed post - please create a new thread.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,412)