Please enable JavaScript to view this site.

Navigation: How To Articles > Automating Win2PDF with Microsoft Power Automate Desktop > Win2PDF Power Automate Desktop Example Flows

How To Compress PDFs Using Power Automate Desktop

Scroll Prev Top Next More

The following Microsoft Power Automate Desktop flow shows how to compress a folder of PDFs in place using the Win2PDF Desktop command line compress command.




To use this "flow", copy the following into a new Power Automate Desktop flow:


Display.SelectFolder Description: $'''Select Folder to Compress''' IsTopMost: False SelectedFolder=> SelectedFolder ButtonPressed=> ButtonPressed3

Folder.GetFiles Folder: SelectedFolder 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=> Files

LOOP FOREACH CurrentItem IN Files

  /# Compress the PDF file in place using the Win2PDF compress command line:

C:\Windows\System32\spool\drivers\x64\3\win2pdfd.exe compress "%CurrentItem%" 50 "%CurrentItem%"#/

  System.RunDOSCommand DOSCommandOrApplication: $'''C:\\Windows\\System32\\spool\\drivers\\x64\\3\\win2pdfd.exe compress \"%CurrentItem%\" 50 \"%CurrentItem%\"''' WorkingDirectory: $'''c:\\windows\\system32\\spool\\drivers\\x64\\3\\''' StandardOutput=> CommandOutput StandardError=> CommandErrorOutput ExitCode=> CommandExitCode