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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / trying to send complet...
Power Apps
Unanswered

trying to send complete report as pdf

(0) ShareShare
ReportReport
Posted on by 12

For the love of god I hope someone can help, I have created an app for reporting but would like to send all the info onto a pdf sheet. to an email address. here is what the app looks like. and the Pdf Background where the text needs to go on.Skærmbillede 2022-04-11 094408.pngSkærmbillede 2022-04-11 094443.pngSkærmbillede 2022-04-11 094510.pngSkærmbillede 2022-04-11 094224.png

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Darkjedithx ,

     

    You could construct a layout with your data in HTML, then pass that to flow to convert into PDF for you?

    If that sounds like something you want to do, try this 

     

    You can use an online HTML editor to get the layout you want, construct it in PowerApps to pass on to Flow, putting your variable data in wherever it needs to go.

     

    Good luck 🙂

     

    WBP

    PS: God's love is free 😉

    Peace

  • Darkjedithx Profile Picture
    12 on at

    Thanks for the info but I am really new to this side of the coin so pretty blank in how to do this.

  • Darkjedithx Profile Picture
    12 on at

    its the HTML Editing to fit this that I dont know how to do. so when they choose (after typing all data in the fields on the app) they can press create and send as pdf file. to an email address.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Darkjedithx ,

     

    So the HTML route is pretty tedious, especially so if you don't know HTML.  You could also go the MSWord layout route and use SharePoint doc library properties to inject data, then convert that to PDF - but that's a whole other process, and just as difficult if you don't know SharePoint or MSWord that well either - so let's look at the HTML for now.

     

    The HTML code provides you with a way to create a layout for a document (typically a web page).  You use it to construct your PDF layout (headers, tables, lines, etc.). 

    You can then inject your data into this layout code so that your data appears in the tables or wherever you want it in the layout.

    Once you have the complete code (layout + data), you would need to send it to Power Automate to save as an HTML file, then then you can use the OneDrive converter to convert that file to PDF and email it to the user for you. 

     

    So, let's say part of your PDF is a table that looks like this; (hopefully the forum table is readable)

    Problem  Solution  
      

    In your app, you have the data for the "Problem" and "Solution" areas sitting in text input controls - let's call them ProblemTextInput and SolutionTextInput - and also the email address of the user you want to send it to - but no nice layout for the PDF. 

    So you construct the layout using an HTML string, and then you break the string to insert your data wherever you need it - eg:

     

     

    Set(varHTML, "
    <table style='border-collapse: collapse; width: 100%; height: 412px;' border='1'>
    <tbody>
    <tr style='height: 18px;'>
    <td style='width: 50%; height: 18px;'>Problem</td>
    <td style='width: 50%; height: 18px;'>Solution</td>
    </tr>
    <tr style='height: 394px;'>
    <td style='width: 50%; height: 394px;'>" & ProblemTextInput.Text & "</td>
    <td style='width: 50%; height: 394px;'> & SolutionTextInput.Text & "</td>
    </tr>
    </tbody>
    </table>
    ");

     

     

    You create a Flow that triggers from PowerApps and takes the HTML string and an email address string.  You can then send these to Power Automate from PowerApps.  If take a look at the link I posted, you can convert the HTML string to an HTML file, then you can convert the HTML file to a PDF, then email it off to whoever needs it.

     

    The tough part is designing the layout, especially if you've never used HTML before - It would probably be easier if you could start with your blank PDF layout already in HTML somehow - if it's in MSWord format that would help as you can save as HTML, but if not you need to convert the entire PDF layout to HTML and bring it into PowerApps as a string.  Have you got that PDF layout in a file format already that you can use?

     

    WBP

  • Darkjedithx Profile Picture
    12 on at

    Thanks for the reply I really appreciate the help😊

    Yes the Last picture I have as a PDF File its just a question of converting all the chosen data to be placed in the PDF file correctly. The dream scenario would actually be instead of the Email screen a button with “create PDF ” Where a window is shown to preview the PDF that its OK And then just one other button with “Send PDF” (To the mail destination. And then it would be done.  

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Darkjedithx,

    So you could create the PDF as described, then populate the built in pdf reader with the PDF so they can see it - but this wouldn't be a very quick process - all in, the user might wait as long as a minute before they see the populated PDF, depending on how quick the conversion and population is... and yes, as Flow can send the email for you, you don't have to use PowerApps to do it - so you can drop the 'send email' button and just get the destination email address to pass on to flow....

    [Edit]

    Actually, you will have the HTML code, so provided it's not too complex for the HTML Text control to process, you could just preview it inside PowerApps using the HTML Text control and insert the variables there....

    [/Edit]

     

    Kind regards,

    WBP 

  • Darkjedithx Profile Picture
    12 on at

    pdf send.png

    So this would be the perfect last screen instead of the email screen option on a previous image in where all the data from the dropdown choices and typed info could be previewed when pressing the "view PDF" button and then press the "PDF send icon" below to send it to the specified email address. (there is only 1 fixed address to send to).

  • Darkjedithx Profile Picture
    12 on at

    The "subject text input field" would be to type where the rapport was done so when the recipient of the incoming mail sees it its clear its from for example "Joe Bloggs Shoes"... 

  • Darkjedithx Profile Picture
    12 on at

    servrap1.jpgThis is the final image where the data Should be placed

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Just a note - you can't 'preview' the pdf without actually creating the pdf, so it is a bit redundant because you have to send the data to flow to create the pdf, then return the pdf content back to PowerApps so it can display the pdf, at which point you then want to 'send' the pdf....which means triggering flow again.... doesn't really make sense.

    Probably easier to 'preview' the PDF using the HTML Text control as I mentioned, then just trigger the flow to convert and send in one shot...but either way, let's demonstrate the thinking;

    I built a quick PowerApp mock-up that does just that - on the page you can see inputs for the fields, an HTML text control that is showing you what the HTML markup of a PDF form might look like, and below that the HTML code inside the control that has the inputs integrated.  By 'integrated' I mean HTML markup has been injected with the input text fields, like this;

     

    "<p>HTML CODE " & injectionVariable & " more HTML code"
    
    eg: "<TD>First Name:</TD><TD>" & TextInput.Text & "</TD>"

     

    When "View PDF" is clicked, the HTML control's HtmlText value, (HtmlTextControl.HtmlText), and the email addres input value (emailTextInput.Text) is sent to a Power Automate flow.  

    The flow uses the HtmlText input from PowerApps to create an HTML file.  It then converts the HTML file to PDF, and sends the PDF content back to PowerApps so it can be displayed. 

     

    Note: I don't send any emails in my flow, but you can add a step to send an email and attach the converted PDF content to it.

     

    Notice, we send the PDF content back to the PDF viewer - not a link to a PDF file.  This is because the PowerApps PDF viewer is very fussy, and you won't get it to display PDF files from a secure source like SPO - so, rather than trying to save PDF's somewhere public for it to process, it's better to pass it the PDF content of the file straight from flow.  We do this by converting the converted base64 pdf content into binary, then convert that into a data URI that the PDF Viewer in PowerApps can translate and display without 'connecting' to a file.  To do this we use a compose step with the following custom expression;

     

     

    datauri(base64ToBinary(body('Convert_file')?['$content']))

     

     

    Here's what the flow looks like;

    wbphtmlpdflow.png

     

    If you like, you can create a file from your conversion data - the Convert function no longer creates the file for you, it just returns the converted content inside the flow - so if you actually want a PDF file saved in the users OneDrive you need to create it from the converted content - hence the 'Create file 2' step.  This isn't actually necessary unless you want a saved file somewhere though - you can easily attach the converted content onto an email without creating a file as well.

    What's nice about a file though, is that you can create a sharable link from it and feed that back to PowerApps as well, in case you want the user to view the PDF in their browser instead of the viewer - and then they have the file in their OneDrive....anyway....

    Also optional - you can delete the HTML file you created - it served it's purpose.  I didn't in my flow, but you can add a remove file step.

     

    Once you're done, you pass the Convert step content output plus whatever else you want back to PowerApps using a "Respond to a PowerApp or flow" action.  You then use this as input into your PDF Viewer's Document: property.

    Obviously, the flow can just as easily email the PDF once it's been created....here's how it looks....

    wbphtmlpdf.gif

     So the View PDF button triggers the flow like this;

     

     

    Set(ConvertFlowResponse, myConversionFlow.Run(emailaddressInput.Text, HTMLText1.HtmlText))

     

     

    and the PDF Viewer becomes visible once the response comes back from Power Automate and it's Document: property looks something like this;

     

     

    ConvertFlowResponse.pdfContent

     

     

    That should be enough to get you going - good luck! 

    WBP

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard