Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Fail to open PDF file

(2) ShareShare
ReportReport
Posted on by 45

Hi everyone.

 

I made a flow which is to attach PDF file (Japanese contents) to an email (outlook) and send it, but when I download the attached file from the sent message, the file is broken.

 

The error message is: PDF file couldn't be opened. because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded). 

S140_0-1720165581933.png

 

Any assistance in this matter would be greatly appreciated. Thank you!

  • S140 Profile Picture
    45 on at
    Re: Fail to open PDF file

    Thank you so much @Sayan 😊
    I will try again 👍

  • Verified answer
    Sayan Profile Picture
    789 Super User 2025 Season 1 on at
    Re: Fail to open PDF file

    Hey @S140 

     

    if your workflow does not give any error that it should be able to send Email.

     

    Just check once that the Email is valid or not.

    After completion of the run of the workflow check the value of the email field that what value it holds inside the output parameter.

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and  Mark it as a Solution ✔️.

    This motivates me solve more problems.

    Thanks,

    Sayan Patra

    RPA Developer

    linkedin.com/in/sayan-patra 

  • S140 Profile Picture
    45 on at
    Re: Fail to open PDF file

    Hi @Sayan ,

     

    Thank you so much for your help again.

     

    When I run this flow, I do not get any errors, however, no emails are sent (I checked in my sent items).


    Am I doing wrong with Step 6 ?
    Step 6: Send Email with options 
    ・"To" >> I choose a value from excel file like below screenshot.
    ・"Attachments" >> Name ( variables('SplitPath')[sub(variables('Length'),1)] )
                                      ContentBytes (FilePath)

    S140_1-1720658131677.png

     

     

     

     

  • Sayan Profile Picture
    789 Super User 2025 Season 1 on at
    Re: Fail to open PDF file

    Hey @S140 

     

    can you please share that what the error you are facing?
    Before sending the email with options You have to Get file content using path.

     

    Sayan_0-1720592970713.png

     

    Solution: 

    I am again sharing the flow please follow this - 

    Step 1: Start with a Trigger

    Sayan_1-1720597665046.png

    Step 2: Initialize Variables

    FilePath: String
    Length: Integer
    SplitPath: Array

    Sayan_2-1720597769339.png

    Sayan_3-1720597838020.png

    Sayan_4-1720597864699.png

    Sayan_5-1720597891499.png

    Step 3: Use Action - List rows present in a table

    Sayan_6-1720597950365.png

    Step 4: Use Action - Apply to each
    Inside Apply to each: 

    Set Variable: 

    Name: FilePath
    Value: Choose the column which contains the FilePath (for example, the Path column).
    Example Value: C:\Users\SayanPatra\OneDrive - XYZ LLC\Desktop\sayan\cian.pdf

    Sayan_7-1720598158332.png

    Set Variable:
    Name: SplitPath
    Value: split(variables('FilePath'),'\')
    This expression splits the file path based on "\" to extract the file content later.

    Sayan_8-1720598291303.png

    Sayan_9-1720598312559.png

     

    Set Variable: 

    Name: Length

    Sayan_10-1720598536477.png

     

    Sayan_11-1720598565099.png

    Set Variable : 

    Name - FilePath

    Sayan_12-1720598874111.png

    Sayan_13-1720598896850.png

    This expression reconstructs the file path. After using this expression, you should get: Desktop\sayan\cian.pdf.

     

    Step 5 : Use Action inside Loop - Get file content using path

    Sayan_14-1720599044171.png

    Step 6 :

    Use Action inside Loop - Send Email with options

    Sayan_15-1720599150146.png

     

    Send Email with options (As I can see that you have to take the Email Id from Excel so in To Section You can Pass the value dynamically directly without spliting)
    Attachments : (Value : variables('SplitPath')[sub(variables('Length'),1)] This Expression will help to get the file Name for Example : cian.pdf according to my file path)
    ContentBytes : Pass the Variable FilePath

     

    Note: Ensure there are no empty parameters in the Send Email with options action.

     

    Additional Note:
    If your file path is not as long as the example path (C:\Users\SayanPatra\OneDrive - XYZ LLC\Desktop\sayan\cian.pdf), you can use the path directly in the Get file content using path action and in the Send Email with options action.

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and Mark it as a Solution 🤖.

    Thanks,

    Sayan Patra

    RPA Developer

     

  • S140 Profile Picture
    45 on at
    Re: Fail to open PDF file

    Hello @Sayan ,

     

    Thank you very much for your kind help.

    I followed your steps and recreated a new flow , however the email could not send this time.

     

    Could you please advise me more about the variables for Name ? (I am not sure what value I should be choose)

    S140_0-1720575248819.png

     

    and this is the EXCEL file I use.

    It provides the following contents and I want to send the emails with the attachments according to this table.

    ・Email address

    ・Name 

    ・File path

    ・File name

    S140_1-1720575837056.png

     

  • Sayan Profile Picture
    789 Super User 2025 Season 1 on at
    Re: Fail to open PDF file

    Hi @S140 

     

    After analysing the workflow, I understand that you are trying to achieve the following:

     

    1. Retrieve an Excel file from the drive.

    2. Extract data from a table within the Excel file.

    3. Apply an action to each item in the table.

    4. Get the file content using its path.

    5.Send an email using Outlook with the file content.

     

    First, I have initialized three variables:

    • FilePath: String
    • Length: Number
    • SplitPath: Array

    After that, I retrieve the table using the action "List Rows Present in a Table." Then, I loop through the body/value, which is the dynamic content of "List Rows Present in a Table."

    Next, I extract the file path and split it into an array, because the FilePath contains the full path, which is not valid for the input FilePath of "Get File Content Using Path."

    Finally, I use "Send Email with Options" to send the email with attachments.

     

    Note: There should be no empty fields in "Send Email with Options.

     

    Sayan_0-1720451284411.pngSayan_1-1720451299922.png

    Sayan_2-1720451320697.png

     

    Sayan_3-1720451333796.png

    Sayan_4-1720451365198.pngSayan_5-1720451384750.png

     

    Sayan_6-1720451413708.pngSayan_7-1720451437016.png

    Sayan_8-1720451459813.png

    Sayan_9-1720451472516.png

     

     

    If my suggestion helped you, please give it a Thumbs up and Mark it as a Solution so that it can benefit others in the community.
    Sayan Patra

    RPA Developer

     

     

  • S140 Profile Picture
    45 on at
    Re: Fail to open PDF file

    Hi @Sayan , thank you for your suggestion.

     

    Despite there being a message related to fonts, I don't believe it to be a font issue because the original file can be opened without any problem.

    It seems more like the PDF file somehow becomes corrupted between Power Automate and Outlook.

     

    Below is a screenshot of the flow (I'm sorry but it is in Japanese as well).

     

    S140_0-1720399521266.png

     

  • Sayan Profile Picture
    789 Super User 2025 Season 1 on at
    Re: Fail to open PDF file

    Hey @S140 “After translating the image you attached to English, I get this: 'Adobe Acrobat could not print the document because it was created with a font that is not available on this system. To print this document, install the font that was used when creating it. Please click OK to close this dialog box.”

     

    "My suggestion is, if you are trying to print it, ensure that the font is available on your system. First, install the font."

     

    can you please share the snapshot of the flow or the flow?

    If my suggestion helped you, please give it a Thumbs up and Mark it as a Solution so that it can benefit others in the community.
    Sayan Patra

    RPA Developer

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1

Featured topics

Restore a deleted flow