Print web page as pdf

96 views
Skip to first unread message

Venu D

unread,
Feb 28, 2023, 7:30:36 AM2/28/23
to headless-dev
Hi 
I am trying to print the webpage as pdf 
by writing below powershell command  line page saved as pdf for public site

.\chrome.exe --headless --print-to-pdf="C:\test\Samples.pdf" https://test.com

if i save any private site  which require authentication so pdf saved as "unauthorized " content.

How to pass the credentials for the above command 

Andrey Kosyakov

unread,
Feb 28, 2023, 3:06:49 PM2/28/23
to Venu D, headless-dev
Hi,

You can't pass credentials to headless, you can either take advantage of sharing profile with a headful version (i.e. authenticate in headful chrome, then pass --user-data-dir=<profile-directory-of-headful-chrome>) so headless can use existent authentication cookies or use some test automation driver (e.g. puppeteer or webdriver) to log in programmatically.

Best regards,
Andrey.


--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/a35dff47-5d6b-47c1-98b8-4728bdcb47edn%40chromium.org.

Venu D

unread,
Mar 2, 2023, 8:29:17 AM3/2/23
to headless-dev, ca...@chromium.org, headless-dev, Venu D
Hi ,
Can you help me, how to authenticate from headfull in powershell and pass to cookies to headless ?
any sample code please

Jerry Lee Daniel

unread,
Nov 19, 2023, 10:29:02 AM11/19/23
to headless-dev, dvg...@gmail.com, ca...@chromium.org
Loans, Project and Digital Investment financing available up to $500m.
Have a Business Plan, Fundable Project and Redeemable Collateral.

Whatsapp: +44 7405 896213

Jerry Lee Daniel

unread,
Nov 19, 2023, 10:35:11 AM11/19/23
to headless-dev, dvg...@gmail.com, ca...@chromium.org
Loans, Project and Digital Investment financing available up to $500m.
Have a Business Plan, Fundable Project and Redeemable Collateral.

Whatsapp: +44 7405 896213

On Thursday, 2 March 2023 at 14:29:17 UTC+1 dvg...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages