Forum Discussion
Custom Format MS Forms to PDF using Power Automate
I finally have my my Power Automate flow setup to generate a pdf form once it is submitted. Then it emails to who it needs to, copy is saved to one drive, and then into to SharePoint. The issue I am having is formatting the pdf to show the question/answers as vertical instead of horizontal. Any assistance would be greatly appreciated. This is for work so I can't use any 3rd party apps to assist with formatting the pdf. Below is an example of what it is doing.
How it is working now:
Question 1: Name: Question 2: Email Address
Answer: Dana Answer: nowhere@nowhere.com
How I want it to work
Question 1: Name Answer:
Question 2: Email Address Answer:
- RobElliottSilver Contributor
DHall78 can you post a screeenshot of the action in the flow where the pdf is created so we can have a look.
Rob
Los Gallardos
Microsoft Power Automate Community Super User- DHall78Copper Contributor
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.
- RobElliottSilver Contributor
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
- jonna1973Copper Contributor
- RobElliottSilver Contributor
jonna1973 who are you directng that question to?
Rob
Los Gallardos
Microsoft Power Automate Community Super User- jonna1973Copper ContributorHi Rob,
anyone that can assist?
I have various forms that I would like an automated process to save as PDF to a SharePoint folder - takes forever continually back and forth to forms and printing to file