Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web2PDF CLI Tool

Python Version License: MIT

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.


Features

  • 🚀 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

Installation

From PyPI (Recommended)

pip install web2pdf

From Source

  1. Clone the repository:

    git clone https://github.com/devbernie/web2pdf.git
    cd web2pdf
  2. Install packages:

    pip install .
  3. Install dependencies:

    pip install -r requirements.txt
  4. Install Playwright browsers:

    playwright install chromium

Usage

Basic Conversion

web2pdf https://example.com output.pdf

Advanced Options

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

Help Command

web2pdf --help

Configuration

Environment Variables

  • WEB2PDF_PROXY: Set default proxy server.

  • WEB2PDF_TIMEOUT: Set default timeout (in milliseconds).


Contributing

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.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Support

If you encounter any issues or have questions, please open an issue.


Made with ❤️ by devbernie

About

CLI tool to convert websites to PDF with advanced options

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages