Forum Discussion
Custom Format MS Forms to PDF using Power Automate
I have attached a copy of my flow. I have everything figured out except how to format the ms forms questions to be vertical on the PDF Form. I would also like to add an image to the format, but not something it has to do. I would really love for the PDF to look like the MS from, but I know that won't happen. Also, I can't use any 3rd party apps to create the flow.
DHall78 yes it's not difficult to add a logo or other images to your email and PDF and make it look similar to the form.
The first part of the flow is straightforward with the Forms trigger and get response details and I've then just converted a date in the form to UK format.
Next you need to get the image you will want to use. I always store this in SharePoint and use a get file content using path action:
The next action is where it gets interesting. What is not widely know it seems is that in the File Content field of the create file action you can add html tags, and you'll need to do this to add the logo and make the table look how you want it. For the image src tag add the expression
dataUri(body('Get_file_content_using_path'))
And complete the table and other info and selecting the relevant form questions and adding in the appropriate html tags:
Next, add the convert file using path action and then another create file action for the pdf (as I'm assuming you'll want to save that as well). The pdf will be created with the file content from the action above including the image:
Finally, in the email turn on code view using the </> button and add in the same img src as before and any other html tags:
So when the email comes in it will look like this:
And the PDF will look like this. Of course you can test it and tweak the html tags so that the result looks similar to your form:
Rob
Los Gallardos
Microsoft Power Automate Community Super User
- Jordib123Jun 27, 2022Copper Contributor
When I try your flow I come to the following problem:
This is my HTML (dont want the image):
Do you know what I have to do? Thanks in advance 🙂
 
- HashSoftApr 01, 2024Copper ContributorUsing this workflow, I am getting empty pdf file as an attachment. If I choose the original HTML file as an attachment, it is working. But again response submitted in multiline are coming as single line in html. Any idea how to fix it?
- BertSchollaertSep 08, 2024Copper ContributorThis is very helpful, thank you very much, Rob!!