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
- Create a local output directory:
mkdir -p output
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file webpage_to_pdf_converter-1.1.0.tar.gz.
File metadata
- Download URL: webpage_to_pdf_converter-1.1.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b442aafddcc30ec805b970837144c20db2caf657373f4a0e314f7facc2388b0
|
|
| MD5 |
4c47a0d144bbad53639a8811cbfbd97c
|
|
| BLAKE2b-256 |
4e68ce646bcfbcd206d0f3b58a42c700b8e960888397f64edce0587f9aac9dc9
|
File details
Details for the file webpage_to_pdf_converter-1.1.0-py3-none-any.whl.
File metadata
- Download URL: webpage_to_pdf_converter-1.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ef61e59602eb2fe5fc1f44ce930a5235318ba7c9730f40231bd2503a7bf8332
|
|
| MD5 |
45f7ded00504b6ac5f3a52b47e02978f
|
|
| BLAKE2b-256 |
d497fa3f5d2dcf10fa1d643a8bd5b483f9c3fdfee2b728c308bcd01f55714d60
|