web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sending Files to PDF p...
Power Automate
Unanswered

Sending Files to PDF printer

(2) ShareShare
ReportReport
Posted on by 261
Dear community
 
I would appreciate your help, if possible, with a desktop flow.
 
Scenario : I have 40,000 pdf documents that are in an unsupported pdf format i.e. they therefore not viewable in SharePoint online.  I need to convert them into a format which is viewable in SharePoint Online. My plan was to use Power Automate Desktop to do so. I have the original names and the new names stored on an Excel spreadsheet and want to use that to save the new pdf printer versions. I believe I could send them to a pdf printer and then name them based on the name on the f
 
I have tried to build the flow but constantly run into issues. Could anyone provide me with some guidance.  I am a newbie to power automate desktop so apologies if I have left anything out on what I want to do / achieve. When I rum the flow below it only seems to create the first file.  Many thanks in advance.
 
 
 
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    What kind of error do you get? Does the error say: “can't print this type of document”?

    If so your pdf files might be set to open in a browser. Change the files to PDF application like Adobe Acrobat. And try then.


    For me it still gives Save Print Output As -window which is bit difficult to automate since it’s a under PADs editor window.


    If that gives you trouble you could use browser to open the pdf and print it with the browser to pdf.
    So change the pdfs to be opened by a browser like Edge and then use Run application to open it and do the steps to print the pdf.




    ​​​​​​​EDIT:
    Actually quicker way is to use VBScript. So have the pdfs to be open with Edge browser by default. Then just add this code to your PAD editor: 
    Folder.GetFiles Folder: $'''C:\\Your\\File\\Path''' FileFilter: $'''*.pdf''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> FilesInFolder
    LOOP FOREACH CurrentItem IN FilesInFolder
        SET FileDir TO CurrentItem.Directory
        SET FileName TO CurrentItem.Name
        SET NewPdfName TO CurrentItem.Directory + '\\' + CurrentItem.NameWithoutExtension + 'New' + '.pdf'
        @@copilotGeneratedAction: 'True'
    Scripting.RunVBScript.RunVBScript VBScriptCode: $'''\' This code has been generated by AI. Original prompt:
    \' give me a script that prints current pdf to microsoft print to pdf format
    Set objShell = CreateObject(\"Shell.Application\")
    Set objFolder = objShell.Namespace(\"%FileDir%\")
    Set objFolderItem = objFolder.ParseName(\"%FileName%\")
    
    \' Open the PDF file
    objFolderItem.InvokeVerb \"Open\"
    
    \' Wait for the PDF to open
    WScript.Sleep 2000
    
    \' Send the print command
    Set objShell = CreateObject(\"WScript.Shell\")
    objShell.SendKeys \"^p\" \' Ctrl + P to open the print dialog
    WScript.Sleep 1000
    
    \' Select \"Microsoft Print to PDF\" printer
    objShell.SendKeys \"%%m\" \' Alt + M to select the printer dropdown
    WScript.Sleep 500
    objShell.SendKeys \"Microsoft Print to PDF\"
    WScript.Sleep 500
    
    \' Confirm the print
    objShell.SendKeys \"{ENTER}\"
    WScript.Sleep 1000
    
    \' Specify the output file path
    objShell.SendKeys \"%NewPdfName%\"
    WScript.Sleep 500
    
    \' Confirm the save
    objShell.SendKeys \"{ENTER}\"''' ScriptOutput=> VBScriptOutput
    END
    



  • Verified answer
    Ciaran Profile Picture
    261 on at
    Hi 
     
    Thank you so much for your response.  Your message definitely helped me crack it. I used the following flow to achieve my aim.  Thank you for giving up your time to help me.
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard