cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Darkjedithx
Frequent Visitor

trying to send complete report as pdf

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

10 REPLIES 10
WannaBePro
Advocate I
Advocate I

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
Frequent Visitor

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

Darkjedithx
Frequent Visitor

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.

WannaBePro
Advocate I
Advocate I

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
Frequent Visitor

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.  

WannaBePro
Advocate I
Advocate I

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 

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).

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"... 

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

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,342)