A PHP library for converting HTML to PDF using the wkhtmltopdf
command-line tool with extensive customization options.
- PHP 7.4+
- wkhtmltopdf binary installed on your system
You can install the package via composer:
composer require eprofos/php-wkhtmltopdf
Caution
This package requires the wkhtmltopdf
binary to be installed on your system. You can download it from the official website for your respective operating system.
Here's a basic example of how to use the library:
use Eprofos\PhpWkhtmltopdf\WKHtmlToPdf;
$wkhtmltopdf = new WKHtmlToPdf('/path/to/wkhtmltopdf');
$wkhtmltopdf->addPage('https://example.com')
->setPageSize('A4')
->setOrientation('Portrait')
->setGrayscale(true)
->setZoom(0.75)
->generate('output.pdf');
For detailed documentation on all features and options, please refer to the documentation.
This library is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please submit pull requests or open issues to help improve this library.
If you experience bugs or want to request new features, please visit the issue tracker.