One of the key features of Power Automate Desktop is having the ability to work with webpage content. Common requests include the ability to create a pdf out of a webpage because maybe every end-user doesn't have access or a license, but you still need to send out a summary or a copy of a page. In today's age, it is very common to have a 3rd party system create reports that only a licensed user can see. Power automate can help and reproduce a webpage as a pdf in only 4 steps!
Step #1: download Google Chrome Canary here: Chrome Canary Features For Developers - Google Chrome
Step #2: open up Canary and get through all the welcome screens and then close! Closing is important! Next find canary and open the file location.
Step #3: You want to copy the target path. Then we will head over to Power Automate Desktop.
Step #4: In Power Automate Desktop, we will create a quick 4 step desktop flow. First, we will open a CMD session. Next, we use write to CMD session, add a delay, then close the CMD session.
The command is in this format:
In quotes, we paste in our target for the canary application followed by --headless=new
Next, we add --print-to-pdf="C:\Users\*****\Downloads\filename.pdf" or any place you want to create the file. Of course, the file naming convention can use dynamic content or variables, it's always your choice!
Lastly, we add the URL of the webpage we want to capture. So, in this example we create a pdf out of the homepage of the Power Automate Community Forums.
"C:\Users\thoma\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --headless=new --print-to-pdf="C:\Users\thoma\Downloads\gheadless_test.pdf" https://powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity
And that's it! Just 4 steps! Here's a more valid use case to consider, imagine you have about 100 shipping reports you need to get out of a 3rd party system every night using your admin login and you want to create a pdf for each report, then save them to SharePoint to share with your team, upload them somewhere, and/or send them to others by email. With this scenario, you can easily feed your desktop flow a list of URLs and loop through them in the middle of the night, creating your pdf copies of your shipping reports.
Give Google headless a try for your next webpage-to-pdf automation project!
My name is Thomas Rice, aka trice602. If you have worked with me before, you know my tagline is.... "Always glad to help! Tom"
LinkedIn: Thomas Rice, PMP | LinkedIn