Skip to main content

A CLI tool to check URLs and save webpages as PDFs

Project description

Webpage2PDF

A CLI tool to check URLs and save webpages as PDFs with advanced error handling and retry mechanisms.

Installation

pip install -e .

Installation from PyPI

pip install webpage-to-pdf-converter

Features

  • URL reachability checking with retry mechanism
  • PDF generation from webpage screenshots
  • Progress indicators and detailed logging
  • Docker support with volume mounting
  • Error handling with detailed messages
  • Configurable timeouts and retries

Usage

Basic URL checking:

webpage-to-pdf https://example.com

Save as PDF with custom settings:

webpage-to-pdf https://example.com --save-pdf --output output.pdf --timeout 60

Docker

Build the Docker image:

docker build -t url-checker .

Running with Docker

  1. Create a local output directory:
mkdir -p output
  1. Run the container with volume mount:
docker run --rm -v $(pwd)/output:/app/output url-checker https://example.com --save-pdf --output /app/output/webpage.pdf

The PDF file will be saved in your local output directory. The tool will show both the container path and the absolute path of the generated file:

✓ PDF saved successfully as '/app/output/webpage.pdf'
File location: /app/output/webpage.pdf

Using the Program with Docker

After building the image, you can run the container to check a URL directly. For example, to check "https://example.com" and save the webpage as a PDF, run:

docker run --rm url-checker https://example.com --save-pdf

Release History

  • 1.1.0 (2024-02-05)

    • Added retry mechanism with exponential backoff
    • Improved error handling and logging
    • Added progress indicators
    • Better Docker volume support
    • Chrome compatibility fixes
  • 1.0.0 (2024-03-XX)

    • Initial release
    • URL reachability checking
    • PDF generation from webpages
    • Docker support
    • Chrome/Chromium support

CI/CD

This project utilizes GitHub Actions for continuous integration. Refer to ci.yml for workflow details.

Development

Install development dependencies:

pip install -e ".[test]"

Run tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webpage_to_pdf_converter-1.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webpage_to_pdf_converter-1.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file webpage_to_pdf_converter-1.1.0.tar.gz.

File metadata

File hashes

Hashes for webpage_to_pdf_converter-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7b442aafddcc30ec805b970837144c20db2caf657373f4a0e314f7facc2388b0
MD5 4c47a0d144bbad53639a8811cbfbd97c
BLAKE2b-256 4e68ce646bcfbcd206d0f3b58a42c700b8e960888397f64edce0587f9aac9dc9

See more details on using hashes here.

File details

Details for the file webpage_to_pdf_converter-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for webpage_to_pdf_converter-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef61e59602eb2fe5fc1f44ce930a5235318ba7c9730f40231bd2503a7bf8332
MD5 45f7ded00504b6ac5f3a52b47e02978f
BLAKE2b-256 d497fa3f5d2dcf10fa1d643a8bd5b483f9c3fdfee2b728c308bcd01f55714d60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page