Web2PDF is a powerful command-line tool for converting websites to PDF files with advanced customization options. Built with Python and Playwright, it supports modern web technologies, including JavaScript-heavy websites.
- 🚀 Convert any website to PDF with a single command
- 🎨 Customize PDF layout (page size, orientation, margins)
- 🔒 Handle authentication (basic auth, cookies)
- ⏱️ Delay rendering to wait for dynamic content
- 📄 Add custom headers and footers
- 🌐 Proxy support for restricted networks
- 🛠️ Batch processing for multiple URLs
pip install web2pdf
-
Clone the repository:
git clone https://github.com/devbernie/web2pdf.git cd web2pdf -
Install packages:
pip install . -
Install dependencies:
pip install -r requirements.txt
-
Install Playwright browsers:
playwright install chromium
web2pdf https://example.com output.pdf
web2pdf https://example.com report.pdf
--page-size A4
--orientation landscape
--margin 1 1 1 1
--header "My Custom Header"
--footer "Page {page} of {total}"
--delay 5000
--auth-user myuser
--auth-pass mypass
web2pdf --help
-
WEB2PDF_PROXY: Set default proxy server. -
WEB2PDF_TIMEOUT: Set default timeout (in milliseconds).
We welcome contributions! Please follow these steps:
1. Fork the repository.
2. Create a new branch (git checkout -b feature/YourFeature).
3. Commit your changes (git commit -m 'Add some feature').
4. Push to the branch (git push origin feature/YourFeature).
5. Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have questions, please open an issue.
Made with ❤️ by devbernie