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 Convert an HTML Web Page To PDF Using Power Automate Desktop and Google Chrome

Scroll Prev Top Next More

The following flow shows how to convert an HTML web page to PDF using the Win2PDF printer and Google Chrome.

 

power-automate-desktop-html-to-pdf-chrome-flow

 

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

 

# Requires the Microsoft Power Automate for Chrome add-on is installed

WebAutomation.LaunchChrome Url: $'''https://helpdesk.win2pdf.com''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False BrowserInstance=> Browser

File.GetTempPath TempFile=> TempFile

WebAutomation.DataExtraction.TakeScreenshotSaveToFile BrowserInstance: Browser File: TempFile FileFormat: WebAutomation.FileFormat.Png

/# Convert the PNG to PDF using the Win2PDF Desktop Command Line

C:\Windows\System32\spool\drivers\x64\3\win2pdfd png2pdf %TempFile% %TempFile%.pdf#/

System.RunDOSCommand DOSCommandOrApplication: $'''C:\\Windows\\System32\\spool\\drivers\\x64\\3\\win2pdfd png2pdf %TempFile% %TempFile%.pdf''' StandardOutput=> CommandOutput StandardError=> CommandErrorOutput ExitCode=> CommandExitCode

/# Make the PDF searchable (optional)

Requires the Win2PDF Desktop with OCR download

C:\Windows\System32\spool\drivers\x64\3\win2pdfd.exe makesearchable %TempFile%.pdf %TempFile%.pdf#/

System.RunDOSCommand DOSCommandOrApplication: $'''C:\\Windows\\System32\\spool\\drivers\\x64\\3\\win2pdfd.exe makesearchable %TempFile%.pdf %TempFile%.pdf''' StandardOutput=> CommandOutput2 StandardError=> CommandErrorOutput2 ExitCode=> CommandExitCode2

# Delete the temporary PNG file

File.Delete Files: TempFile

WebAutomation.CloseWebBrowser BrowserInstance: Browser

# Open the PDF using the default viewer

System.RunApplication ApplicationPath: $'''%TempFile%.pdf''' WindowStyle: System.ProcessWindowStyle.Normal ProcessId=> AppProcessId