Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Convert Web Pages to PDF Using Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Stirling-PDF is is a robust, locally hosted web-based PDF manipulation tool using Docker.

python-pdfkit

Python wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit.

Or you can add options.AddArgument("---printing") to automatically click the print button.

https://stackoverflow.com/questions/30452395/selenium-pdf-automatic-download-not-working

Sikuli

PyAutoGUI + WebBrowser

Other Solutions

Automate Web Page To PDF introduces a way of using PyAutoGUI to automate the convertion of web pages to PDF.