Skip to main content

html2pdf4doc_python

html2pdf4doc_python is the Python wrapper/CLI for the html2pdf4doc JavaScript library that prints HTML pages into PDFs using Chrome/Chromedriver.

This repository focuses strictly on the Python-side automation layer. The rendering logic remains in the JS core.

Installation

  1. Install Google Chrome (or Chrome for Testing) on the machine that will run the CLI.

  2. Install the package from PyPI:

pip install html2pdf4doc

Python 3.8+ is required.

See also: the Ubuntu-based container Dockerfile and the GitHub CI files found in the .github/workflows folder.

Usage

Download or reuse ChromeDriver with SSL verification enabled by default:

python -m html2pdf4doc.main get_driver
python -m html2pdf4doc.main print input.html output.pdf

Disable SSL (corporate environments)

Disable SSL certificate verification only when needed, for example in a restricted corporate environment with custom TLS interception:

python -m html2pdf4doc.main get_driver --disable-ssl-check
python -m html2pdf4doc.main print --disable-ssl-check input.html output.pdf

Developer guide

Getting started

1. (Optional) Create and activate a virtual environment

python -m venv .venv && source .venv/bin/activate

2. Install the dependencies

git clone https://github.com/strictdoc-project/html2pdf4doc_python.git
cd html2pdf4doc_python

# Bootstrap minimal Python dependencies: Invoke and TOML.
pip install invoke toml

# Install all Python dependencies and update the submodule with the html2pdf4doc.js.
invoke bootstrap

3. The JS library is maintained in a Git submodule submodules/html2pdf.

When the submodule is updated after a release or during the development, rebuild the JS library, i.e., regenerate the html2pdf4doc.min.js:

invoke build

4. To validate changes, use the following commands:

invoke lint
invoke test  # Normal tests.
invoke test-fuzz  # More robust testing.

License

The project is distributed under the Apache License 2.0 (see LICENSE).

Metadata

Release files for html2pdf4doc 0.0.34

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html2pdf4doc 0.0.34
File Size Uploaded
html2pdf4doc-0.0.34.tar.gz 62.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for html2pdf4doc 0.0.34
File Interpreter ABI Platform
html2pdf4doc-0.0.34-py3-none-any.whl Python 3 none any Details

Total release size: 126.3 kB

Release files / html2pdf4doc-0.0.34.tar.gz

Download URL html2pdf4doc-0.0.34.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
aa2fabbcaecdcae86d847d7ea8c148efd9462704672ebff9edcfce81441e98dd
BLAKE2b-256 checksum
How to use checksums
873a2c15ff2000e1c6ceda5ae52a3ed35c4236bed48451347a0fd71ba43cde6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / html2pdf4doc-0.0.34-py3-none-any.whl

Download URL html2pdf4doc-0.0.34-py3-none-any.whl
Size 64.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f44da9468e1c9da75a0a066bc9120fad1faf827b57c37e29c1f333122d5cb98b
BLAKE2b-256 checksum
How to use checksums
024833e192f055f1fd13effdc01f14360faf36034626b17a97ca5f652cd2aa91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.0.35

2 release files

This release

0.0.34 This release

2 release files

0.0.33

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.23

2 release files

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page