|
| 1 | +# html2pdf4doc_python |
| 2 | + |
| 3 | +html2pdf4doc_python is the Python wrapper/CLI for the HTML2PDF4Doc JavaScript |
| 4 | +library that drives Chrome/Chromedriver to render HTML pages into PDFs. |
| 5 | + |
| 6 | +This repository focuses strictly on the Python-side automation layer. The |
| 7 | +rendering logic remains in the JS core. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +1. Install Google Chrome (or Chrome for Testing) on the machine that will run the CLI. |
| 12 | + |
| 13 | +2. Install the package from PyPI: |
| 14 | + |
| 15 | +```bash |
| 16 | +pip install html2pdf4doc |
| 17 | +``` |
| 18 | + |
| 19 | +Python 3.8+ is required. |
| 20 | + |
| 21 | +See also: the Ubuntu-based container `Dockerfile` and the GitHub CI files found |
| 22 | +in the `.github/workflows` folder. |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +TBD |
| 27 | + |
| 28 | +## Developer guide |
| 29 | + |
| 30 | +### Getting started |
| 31 | + |
| 32 | +1\. (Optional) Create and activate a virtual environment |
| 33 | + |
| 34 | +``` |
| 35 | +python -m venv .venv && source .venv/bin/activate |
| 36 | +``` |
| 37 | + |
| 38 | +2\. Install the dependencies |
| 39 | + |
| 40 | +``` |
| 41 | +git clone https://github.com/strictdoc-project/html2pdf4doc_python.git |
| 42 | +cd html2pdf4doc_python |
| 43 | +
|
| 44 | +# Bootstrap minimal Python dependencies: Invoke and TOML. |
| 45 | +pip install invoke toml |
| 46 | +
|
| 47 | +# Install all Python dependencies and update the submodule with the html2pdf4doc.js. |
| 48 | +invoke bootstrap |
| 49 | +``` |
| 50 | + |
| 51 | +3\. The JS library is maintained in a Git submodule `submodules/html2pdf`. |
| 52 | + |
| 53 | +When the submodule is updated after a release or during the development, rebuild |
| 54 | +the JS library, i.e., regenerate the `html2pdf4doc.min.js`: |
| 55 | + |
| 56 | +``` |
| 57 | +invoke build |
| 58 | +``` |
| 59 | + |
| 60 | +4\. To validate changes, use the following commands: |
| 61 | + |
| 62 | +``` |
| 63 | +invoke lint |
| 64 | +invoke test # Normal tests. |
| 65 | +invoke test-fuzz # More robust testing. |
| 66 | +``` |
| 67 | + |
| 68 | +## License |
| 69 | + |
| 70 | +The project is distributed under the Apache License 2.0 (see `LICENSE`). |
0 commit comments