hook-dev-alter / wkhtmltopdf-bin
The wkhtmltopdf binary (linux x86-64, official wkhtmltox build) packaged for composer, plus a PHP locator for the executable.
Requires
- php: ^8.3
- symfony/process: ^7.2 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^11.5 || ^12.0 || ^13.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-14 23:32:50 UTC
README
Provides the wkhtmltopdf binary (licensed
LGPL-3.0,
currently only linux x86-64, the official wkhtmltox Debian bookworm build from
wkhtmltopdf/packaging) packaged for
Composer, plus a small PHP locator for the executable. Pair it with a command
wrapper such as mikehaertl/phpwkhtmltopdf.
Installation
composer require hook-dev-alter/wkhtmltopdf-bin
This installs the wkhtmltopdf binary as a Composer bin (vendor/bin/wkhtmltopdf)
and the HOOK_DEV_ALTER\WkhtmltopdfBin PHP classes.
Usage
use HOOK_DEV_ALTER\WkhtmltopdfBin\WkhtmltopdfBinary;
use mikehaertl\wkhtmlto\Pdf;
$pdf = new Pdf([
'binary' => WkhtmltopdfBinary::default()->path,
'disable-javascript',
'disable-local-file-access',
]);
WkhtmltopdfBinary::default() resolves, in order: the WKHTMLTOPDF_BIN
environment variable, the packaged binary, then wkhtmltopdf on the PATH.
Runtime requirements
The binary is dynamically linked against a few system libraries. On Debian /
Ubuntu these are the packages the official .deb depends on:
ca-certificates fontconfig libc6 libfreetype6 libjpeg62-turbo libpng16-16
libssl3 libstdc++6 libx11-6 libxcb1 libxext6 libxrender1 xfonts-75dpi
xfonts-base zlib1g
Check with ldd vendor/bin/wkhtmltopdf | grep 'not found'.
Supported platform
The packaged binary only supports linux x86-64. On any other platform,
set the WKHTMLTOPDF_BIN environment variable to a compatible wkhtmltopdf
binary; WkhtmltopdfBinary picks it up before falling back to the packaged
binary or the PATH.
Security note
Upstream wkhtmltopdf is unmaintained (last release 0.12.6, 2020; Qt 4 / WebKit
2012). Its maintainers advise against feeding it untrusted HTML. Only render
HTML you control, and always pass --disable-javascript and
--disable-local-file-access, with a process timeout.
Version policy
The vendored binary's version is recorded in the VERSION file at the
package root. To update it, run:
./build.sh # default: 0.12.6.1-3
./build.sh 0.12.6.1-3 # or pin an explicit packaging release
This downloads the bookworm amd64 .deb, extracts wkhtmltopdf, replaces
bin/wkhtmltopdf, updates VERSION, and commits and tags the result.