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 Automate / File Conversion to PDF
Power Automate
Answered

File Conversion to PDF

(2) ShareShare
ReportReport
Posted on by 171
Hello All,

I have been working in a flow and ran into an issue. My flow trigger is when a new email arrives to the shared mailbox. The condition is if an email comes from  2 specified email addresses, then convert the body of the email to a PDF and name the PDF customer name and amount. Once It has been converted to a PDF, an email has to be sent to another mailbox in the move to another Folder. The issue I am running into is that the body of the email is not being converted correctly, customer name and amount. The PDF that it converts to has the customer name. However, the customer amount is not coming over in the PDF. Does anyone know how I can get the amount into the PDF Name me convention? I have looked into Microsoft copilot and it keeps having me add composes and using expressions and not the dynamic content, which I think is a little overboard. Please help.
IMG_9051.jpeg
IMG_9052.jpeg
IMG_9053.jpeg

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    I did something like this recently for a client.  What we ended up doing was Creating an HTML document from the body of the email, Then using that to create a file in OneDrive for Business and finally converting that file to a PDF.  To do that we needed to replace the HTML tag in the email body with using a Replace to add the !DOCTYPE attribute.
     
    replace(triggerOutputs()?['body/body'],'<html>','<!DOCTYPE html>')
     
    You would also need to insert the Customer name and formatted amount into the body of the email as well.  Probably by using a Replace() on the <body> tag in the embedded HTML.
     
    Here's an overall screenshot of a POC I built.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Verified answer
    Haque Profile Picture
    3,653 on at
    Hi @Olijk
     
    I agree with Pstork1.  I am adding some precatutions that we need to take care of:
     
    • Let's make sure the amount is being extracted from the email body or metadata correctly. If it’s inside the email body, we might need to parse the email content (HTML or plain text) to get the amount value reliably.
    • If the amount is in a consistent format or position, consider using simple expressions like substring(), split(), or indexOf() to extract it directly from the email body text.
    • Definitely we must Concatenate customer name and amount in the file name, so on "Create file" or "Convert to PDF" action, we will use an expression like: concat(triggerOutputs()?['body/fromCustomerName'], '_', triggerOutputs()?['body/amount'])act to do so, let's take best measure if either field is empty! So, let's consider negative testing in the first place.
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Olijk Profile Picture
    171 on at
    Hello @Pstork1 and @Haque,
     
    Thank you so much for your email! My license does not come create/convert html.  I had to use the Compose workaround.  The amount is not in a consistent format or position. Any other suggestions will be greatly appreciated.  Thank you!
  • Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    @Olijk Those actions were just renamed.  Use the OneDrive Action Create File to create the file from the HTML source and the OneDrive action Convert File to convert it to PDF.  As long as you have a Microsoft 365 license those are included.  I don't think there is any way to do it with the Free Power Automate license.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Olijk Profile Picture
    171 on at
    Hello@Pstork1,
     
    Thank you! I had to add HTML to text aunt run a prompt for it to work. I added in the convert and create a file which helped. However, now my PDFs are coming back blank.🤔
    IMG_9134.jpeg
    IMG_9133.jpeg

    Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

  • Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    Unfortunately, we can't see your screenshots.  So its hard to figure out what is going wrong.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard