web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Canvas App PDF Experim...
Power Apps
Unanswered

Canvas App PDF Experimental preview of pdf within dataverse table

(0) ShareShare
ReportReport
Posted on by 26

I am looking for the function that would allow me to preview an existing pdf attachment stored in a dataverse column. I would like to preview the existing pdf within the main form container when the record is open and cannot see how I can reference the record pdf attachment.  Can someone help me with to accomplish this function?  

I have the same question (0)
  • Shashank Bhide Profile Picture
    942 Moderator on at

    you can try to write a power automate which reads the PDF content and converts it to a base64, then return a base64 URL like below and then bind that URL to the experimental PDF viewer.

     

    data:application/pdf;base64,JVBERi0xLjUK...

     

     

    https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/controls/control-pdf-viewer

     

  • steeevid Profile Picture
    323 Super User 2024 Season 1 on at

    Are you using model driven app? I achieved this using model driven app with embedded canvas app, you do not need to do any base64 conversion, just add pdf viewer control and reference the pdf file using index(@modeldrivenintegration.attachments, index number).value and the pdf will show up.

     

    you can add a left and right button to change your index so you can browse through a list of attachments 

  • Doug Randall Profile Picture
    26 on at

    Hi Stevie,

    Yes this is mainly what I am trying to accomplish where the model driven app contains a table "Payment Approvals" and a file column "Payment Document" .  Here I display it on the main form and then also embed the pdf viewer control as a canvas app 

    DouglasR_0-1712240614807.png

     

    how can I have the canvas app PDF Control refer to that column document for preview without necessary adding those fields visible in the canvas app .... as the core function is just to preview the pdf i.e.

     

    DouglasR_1-1712241121502.png

     

     

     

  • steeevid Profile Picture
    323 Super User 2024 Season 1 on at

    Just refer to the column name of your file column?

  • Static Profile Picture
    118 on at

    Hi @DouglasR ,

     

    So you can use PDF viewer. https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/controls/control-pdf-viewer
    Add any gallery and function on galery.selected.attachemt

  • Doug Randall Profile Picture
    26 on at

    Can you outline the steps to insert the attachment from the form on the gallery so that I can then set it to the PDF viewer as that above does not work for me.

  • steeevid Profile Picture
    323 Super User 2024 Season 1 on at

    You don't need a gallery control as you only have 1 file column. just reference to the file column in the pdf viewer and the pdf will show up.

  • Rajath_mk Profile Picture
    93 on at

    Hi @DouglasR ,

     

    I recently had the same issue where I wanted the users to preview the document without having to download it. Hopefully this helps you.

     

    I loosely followed this Blogpost by Pieter to get the “ModelDrivenFormIntegration” component into my canvas app. Once that was there, I just had to add the “PDF Viewer” component into the canvas app. Then in the formula bar of Document property,I just queried the pdf file. In my case, it was a Safety data sheet connected to the form line item. 

     

    [@ModelDrivenFormIntegration].Item.'SDS File'.Value

     


    Also make sure that in the display settings for the canvas app to turn off the Scale to fit option as the PDF will look fuzzy when its published with it turned on. Then you just have to publish the form and ignore any errors you see, it will be working when you play the model driven app. 

     

    I also tried using a http web request to dynamically get the attachment and tried a html response to vizualize it in a new tab, it worked only on PC's but downloaded the file on mobile. 

     

    Hopefully this helps you. Let me know how you go or if you have any questions.

     

    Rajath_mk_0-1712276043880.png

     

     

  • Doug Randall Profile Picture
    26 on at

    Hi Rajath,

     

    Thank you for the link and what you have shown is exactly also I want to do where just preview the pdf in the form.  A few questions regarding

    1. Did you still require to Create a flow to collect the PDF Data?  and since my pdf attachment is within the dataverse table column and not sharepoint.   Would you know if this is still possible or can you share a bit of the flow details to accomplish?

     

    2.  Creating an embedded Canvas App - (as I have similar also just the pdf viewer control within).  I add it to the model driven app -- entity form -->  as described in the article where I still need to specify the following to add

    DouglasR_2-1712280010049.png

     

     

    but after I save and then switch to classic mode I do not have the controls tab under the field properties  of the embedded app

    DouglasR_1-1712279726257.png

    So I am not able to further set the controls or customize to get the modelintegration?

     

    Although it is somewhat embedded as can see the default samplePDF ... but do not have the modelintegration in the canvas app PDF Preview.

     

    Thus I am a little stuck on the next steps and appreciate your help

     

     

     

     

  • Verified answer
    Rajath_mk Profile Picture
    93 on at

    Hi @DouglasR ,

     

    The link I shared might be for an older method requiring a flow to show the data. But you don't actually need it. You just need the ModelDrivenApp Integration thats it. Here is how.

     

    In you Model driven App form designer, add a column that you know will contain data. For my example, I took the primary column of the table called "Name". You cannot do this to the actual file column for some reason as I just tested, dont worry the end result will be the same.

     

    Rajath_mk_0-1712283763657.png

     

    Save and Publish the form. Afterwords, on the same designer page click on Switch to classic

    Find the column you just added, and double-click on it. You should see the Controls Tab. Select Add controls and add Canvas App control, then select it form Web and Tablet and if you want Phone. Dont edit anything else here and directly click on the Customize button.

     

    Rajath_mk_1-1712283908846.png

     

    Once you hit customize button, PowerApps loads the canvas builder interface in a new tab. Now you should see the ModelDrivenFormIntegration in the tree view on left side.

    Rajath_mk_2-1712284060035.png

     

    Now you can delete the Form1 as you dont need it. Then add the PDF viewer. Under Document action, in formula bar add the following

     

    [@ModelDrivenFormIntegration].Item.'Your File Column Name'.Value

     

    Basically, the ModelDrivenFormIntegraiton pulls the current rows data, so you dont need to create a flow to get your file data into the canvas app.

    Rajath_mk_3-1712284405932.png

     

    Save and Publish the App, also make sure that in the display settings for the canvas app to turn off the Scale to fit option as the PDF will look fuzzy when its published with it turned on.

    Once that is done, you can close the tab and go back to your classic editor, you will see it prefilled with the information of the canvass app you just created. Hit OK and then Save and Publish.

    Rajath_mk_4-1712284698461.png

     

    Give the app an update after a minute.  And you should be able to view the PDF as shown below, I custamized the form a bit more in the moden form controls after this, if you see licensing error, dont worry about it.

    Rajath_mk_5-1712285043175.png

     

    You will have to share the canvas app to all your users also. But dont worry, as long as they access the canvas app from within the Model driven App they wont be hit with additional licensing.

     

    Hopefully this solves you problem.



    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard