From febd42a13d27768e95458f08e66a78242c4207bc Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Sun, 13 Sep 2026 13:00:29 +0200 Subject: [PATCH] docs(README): document the usage of --chrome-binary --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index c6e404c..4df9f81 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,30 @@ python -m html2pdf4doc.main get_driver --disable-ssl-check python -m html2pdf4doc.main print --disable-ssl-check input.html output.pdf ``` +### Pin a specific Chrome binary + +Pin a specific Chrome/Chromium binary with `--chrome-binary`, for example to +use Chrome for Testing or a binary in a non-standard location. Without this +flag, `html2pdf4doc` auto-detects the Chrome/Chromium binary on the machine. + +```bash +python -m html2pdf4doc.main get_driver --chrome-binary /path/to/chrome +python -m html2pdf4doc.main print --chrome-binary /path/to/chrome input.html output.pdf +``` + +Set the `HTML2PDF4DOC_CHROME_BINARY` environment variable instead of the +flag, for example in CI or Docker environments: + +```bash +export HTML2PDF4DOC_CHROME_BINARY=/path/to/chrome +python -m html2pdf4doc.main print input.html output.pdf +``` + +`html2pdf4doc` resolves the Chrome binary in this order: +- `--chrome-binary` +- `HTML2PDF4DOC_CHROME_BINARY` +- auto-detection. + ## Developer guide ### Getting started