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 / How to convert word do...
Power Automate
Answered

How to convert word doc to pdf in PAD

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

Is there any option available in PAD to automatically convert word doc to pdf? Please help

I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

    Unfortunately PAD doesn't have Word automation actions right now. You have to automate it by UI elements.

    Try this sequence:

    1. 'Run application' and provide the fulle name of .doc file to open it

    2. 'Get window', foreground window (%AutomationWindow% as output)

    3. 'Focus window', by instance= %AutomationWindow%

    4. 'Send keys' {LControlKey}({P}) 'This will open Print option in Word

    5.  'Set drop-down list value in window': here you have to capture the Printer drop-down field UI. Operation= Select option(s) by name, Name= 'Microsoft Print to PDF'

    6. 'Press button in window': capture the Print button UI

    7. From here, you have to select folder + name of saved file. You can use Message Box actions to input folder/name you want, or predefine it in a variable..

     

    Good luck!

  • Verified answer
    yoko2020 Profile Picture
    495 on at

    If you have microsoft office installed, you can use powershell

     

    #Creates a Word-Object
    $word = New-Object -ComObject Word.Application
    $word.Visible = $false
    $doc = $word.Documents.Open("C:\Temp\Document.docx")
    #Creates the PDF file
    $name = ($doc.FullName).replace('docx', 'pdf')
    $doc.SaveAs($name, 17)
    $doc.Close()
    $word.Quit()
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I tried this using PowerShell, it is working but can you explain me the code like how it works because I am not aware of powershell script.

    If you can give me an explanation of the code, I can understand the code better and incase any changes needed, I can modify.

  • XRQ57 Profile Picture
    206 on at

    Hi

    Is there a powershell code for png files to PDF?

    Thanks

  • yoko2020 Profile Picture
    495 on at

    @Anonymous 

    This is the code for running in PAD.

    #Get word file location from PAD variable
    $PathFile = '%PathFileFromPAD%'
    
    #Creates a Word-Object
    $word = New-Object -ComObject Word.Application
    
    #Set word instance hidden
    $word.Visible = $false
    
    #Open the document
    $doc = $word.Documents.Open('$PathFile')
    
    #Creates the PDF file
    $name = ($doc.FullName).replace('docx', 'pdf')
    
    # 17 is pdf format https://docs.microsoft.com/en-us/office/vba/api/word.wdsaveformat
    $doc.SaveAs($name, 17)
    
    #Close instance
    $doc.Close()
    $word.Quit()

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    thanks!

  • Pavel_NaNoi Profile Picture
    1,074 on at

    Funnily enough there is an action that can convert a word document into a pdf called "Rename File(s)" where you can change the extension, unfortunately its bugged, it does the job but the pdf file it makes is un-openable.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    yes, I tried "Rename File(s)" before and as you said, it is not working as expected.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have a folders which have multiple file extensions that have to be converted to pdf. For ex: I have .doc, .docx, .jpg.

    Is there a single power shell code to convert these file extensions  to pdf?

    Please help.

     

  • RaKaAsura Profile Picture
    3 on at

    I regularly get files from multiple sources which are in different formats, mostly PDF, but also includes few PNG, docx, xlsx files. I have to merge all these documents into a single PDF and forward to multiple IDs. I want to use Merge PDF Flow but it throws an error whenever there is a PNG or docx file.

     

    What step to use to convert these to PDF before using the Merge PDF flow?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard