Download html pages as pdf using headless Chrome

58 views
Skip to first unread message

Aadil Rashid

unread,
Jan 29, 2022, 10:59:05 AM1/29/22
to django...@googlegroups.com
Hello Django Family, I came across the problem of downloading HTML pages as pdf using headless chrome, Can anybody here who could please let me know how can I do it or any good resource to follow, it would be appreciable. I am using Django python,
Thank you very much.

Vishesh Mangla

unread,
Jan 29, 2022, 11:00:04 AM1/29/22
to django...@googlegroups.com
Use requests for that .

On Sat, 29 Jan 2022, 21:28 Aadil Rashid, <aadil1...@gmail.com> wrote:
Hello Django Family, I came across the problem of downloading HTML pages as pdf using headless chrome, Can anybody here who could please let me know how can I do it or any good resource to follow, it would be appreciable. I am using Django python,
Thank you very much.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAYXZx-Ar-PeKeOLA27TgTwQoct3e9Y1E%2BAPtWyPQMq78EaTNg%40mail.gmail.com.

Vishesh Mangla

unread,
Jan 29, 2022, 11:02:14 AM1/29/22
to django...@googlegroups.com
Get the link and cookies from the webdriver and put that in requests.get using request library to download the html on the page.

Aadil Rashid

unread,
Jan 29, 2022, 11:15:34 AM1/29/22
to django...@googlegroups.com

from request.get("https://---") i am getting instance of requests.models.Response, how can i convert it to pdf

Vishesh Mangla

unread,
Jan 29, 2022, 11:19:40 AM1/29/22
to django...@googlegroups.com
If it's a pdf then u can download the bytes.
So search Google/stackoverflow for "requests download bytes".

Kasper Laudrup

unread,
Jan 29, 2022, 12:10:55 PM1/29/22
to django...@googlegroups.com
You cannot use Django for that. Django is a server side web framework
library, so you will not find any resources to follow for good reasons.

You could use something like requests instead if you want to use Python.

Kind regards,

Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

Aadil Rashid

unread,
Jan 29, 2022, 12:33:00 PM1/29/22
to django...@googlegroups.com
Hello, Kasper Laudrup  I really appreciate your idea, but i need to get this done only by using headless chrome. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages