Skip to main content

Notifications

Community site session details

Community site session details

Session Id : kHVz9Q6r5+jq2PUzRLVday
Power Automate - Power Automate Desktop
Unanswered

Print or Save Webpage to PDF

Like (0) ShareShare
ReportReport
Posted on 16 May 2021 16:41:48 by 8

Hello

 

I have already built a solution using web recorder which takes me to a specific webpage. We need to print to PDF the webpage.

 

On the page there is a Print button which does this:

 

javascript:window.print()

 

The problem is the web recorder does not record anything I do within the standard Chrome print dialog box (e.g. selecting the destination as 'Save as PDF', or actually clicking the blue 'Save' button.

 

I do not want to screenshot the webpage for formatting reasons.

 

Also, I would need some advice as to how to handle the actual PDF i.e once the save button is clicked, how to programmatically choose a file name and folder to save it.

 

I do not mind if the solution is to use another browser (currently using Chrome).

 

Thank you

  • Community Power Platform Member Profile Picture
    on 24 Jan 2022 at 05:53:52
    Re: Print or Save Webpage to PDF

    I know I'm late to the party but I just had this issue too.  What I did was to select Adobe DC as my default viewer to .png.  So I save webpage and it saves as png but when I open it, BOOM!  PDF

  • VJR Profile Picture
    7,635 on 07 Dec 2021 at 06:25:07
    Re: Print or Save Webpage to PDF

    Hi @OXDevUser 

     

    - After pressing Ctrl P

    - Give a wait stage for the print dialog to open

    - Then sendkeys for Enter

    This will hit the save button.

     

    Here it is assumed that you already have set the destination to "Save as Pdf"

     

  • MichaelAnnis Profile Picture
    5,721 Super User 2025 Season 1 on 07 Dec 2021 at 05:38:49
    Re: Print or Save Webpage to PDF

    1) I would use {LControlKey}(p) - Send Keys can read “P” as Shift+p.

    2). I don’t think I have tried print to pdf and then had a save button, it’s usually a print button. If there is a save button, try send keys for control + s.

     

    Hope this helps. 

  • OXDevUser Profile Picture
    4 on 07 Dec 2021 at 04:37:58
    Re: Print or Save Webpage to PDF

    @Anonymous / @Anonymous: I'm always getting the error: "Failed to press button (button wasn't found)" in my Action 10.  Are you able to provide a step by step screencapture of how you were able to get it to work?

    OXDevUser_0-1638851779841.png

     

  • Community Power Platform Member Profile Picture
    on 29 Aug 2021 at 18:13:18
    Re: Print or Save Webpage to PDF

    Thanks a  lot, work in Chrome too.

  • Community Power Platform Member Profile Picture
    on 16 Aug 2021 at 14:23:03
    Re: Print or Save Webpage to PDF

    1. 'Launch new Edge' with the page you want
    2. 'Display select folder dialog' - select folder to save. %SelectedFolder% as variable produced
    3. 'Display input dialog' - define file name to save. Define %File% as variable produced
    4. 'Set variable' %FileName% = %SelectedFolder%\%File%
    5. 'Get window', foreground window
    6. 'Focus window', by instance = %AutomationWindow%
    7. 'Send keys' {LControlKey}({P})
    From here, use Desktop Recorder to get UI elements:
    8. Select Save as PDF and click button 'Save'
    9. In the 'Save as' window, select 'Name' field and populate it with %FileName%
    10. Click 'Save'

  • Community Power Platform Member Profile Picture
    on 15 Aug 2021 at 17:11:48
    Re: Print or Save Webpage to PDF

    By the moment I use this option with Chrome "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk-printing for resolve the problem, the flow is working.

  • Dudeonyx Profile Picture
    2 on 22 May 2021 at 20:56:57
    Re: Print or Save Webpage to PDF

    Switch to the Desktop recorder after you get to the print dialog.

     

    The print dialog isn't a webpage so the Web recorder won't work on it

  • great1 Profile Picture
    8 on 18 May 2021 at 09:29:44
    Re: Print or Save Webpage to PDF

    Hello everyone.

     

    any help with this project would be much appreciated!

     

    many thanks in advance

     

    great1

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard