This guide details how to install the necessary system dependencies for PDFLib v3.1 on macOS, Ubuntu/Debian, and Windows.
For convenience, we provide a cross-platform script that automatically detects your OS and installs the required dependencies (Ghostscript, PDFtk, Tesseract) using your system's package manager.
./bin/install-dependencies- macOS: Uses Homebrew
- Windows: Uses Chocolatey
- Linux: Uses Apt
If you prefer to install dependencies manually, or need specific versions, please follow the detailed guides below.
Requirement: PHP >= 8.1
brew install phpsudo apt update
sudo apt install php8.1 php8.1-cli php8.1-mbstring php8.1-xml php8.1-zip- Download the Non-Thread Safe (NTS) version from windows.php.net.
- Extract to
C:\php. - Add
C:\phpto your System PATH environment variable.
You only need to install the tools for the drivers you intend to use.
| Feature | Driver | Requirement |
|---|---|---|
| Manipulation | GhostscriptDriver |
Ghostscript |
| HTML to PDF | ChromeHeadlessDriver |
Google Chrome |
| Form Filling | PdftkDriver |
PDFtk |
| OCR | TesseractDriver |
Tesseract |
| Signatures | OpenSslDriver |
OpenSSL (Built-in to PHP) |
Required for: Merge, Split, Convert, Compress, Flatten, Redact.
Version: 9.16 or higher
brew install ghostscriptsudo apt install ghostscript- Download
Ghostscript AGPL Releasefrom ghostscript.com. - Install the package.
- Critical: Add the
binandlibfolders to your PATH (e.g.,C:\Program Files\gs\gs9.55.0\bin). - PDFLib looks for
gswin64c.exeautomatically.
Required for: HTML to PDF conversion.
brew install --cask google-chrome
# OR
brew install chromium# Install stable Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.debStandard installation of Google Chrome is sufficient. PDFLib will auto-detect it in standard Program Files locations.
Required for: Form Filling and Inspection.
brew install pdftk-javasudo apt install pdftk- Download PDFtk Server from pdflabs.com.
- Run the installer.
- Ensure "Add application to your system path" is checked during installation.
Required for: Text Extraction (OCR).
brew install tesseractsudo apt install tesseract-ocr- Download the installer from the UB-Mannheim Tesseract Wiki.
- Install and add the install directory to your PATH.
PDFLib tries to find these binaries automatically. If you have installed them in non-standard locations, you can explicitly configure paths in config/pdflib.php (for Laravel) or pass them to the Driver.
// Manual Driver Configuration
$driver = new \ImalH\PDFLib\Drivers\GhostscriptDriver(
binaryPath: '/custom/path/to/gs'
);