eprofos / php-wkhtmltopdf
A PHP library for converting HTML to PDF using wkhtmltopdf with extensive customization options.
Requires
- php: >=7.4
- symfony/console: ^4.4 || ^5.0
- symfony/event-dispatcher: ^4.4 || ^5.0
- symfony/filesystem: ^4.4 || ^5.0
- symfony/finder: ^4.4 || ^5.0
- symfony/options-resolver: ^4.4 || ^5.0
- symfony/process: ^4.4 || ^5.0
- symfony/stopwatch: ^4.4 || ^5.0
- symfony/string: ^4.4 || ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
README
A PHP library for converting HTML to PDF using the wkhtmltopdf
command-line tool with extensive customization options.
Requirements
- PHP 7.4+
- wkhtmltopdf binary installed on your system
Installation
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.
Usage
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');
Documentation
For detailed documentation on all features and options, please refer to the documentation.
License
This library is licensed under the MIT License. See the LICENSE file for more details.
Contributing
Contributions are welcome! Please submit pull requests or open issues to help improve this library.
Contact
If you experience bugs or want to request new features, please visit the issue tracker.