alberon / htmltopdf
HTML to PDF PHP wrapper with executable files
Installs: 79
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 8
Forks: 1
Open Issues: 0
pkg:composer/alberon/htmltopdf
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2021-02-12 08:59:57 UTC
README
PHP wrapper for wkhtmltopdf http://wkhtmltopdf.org/downloads.html
Install
-
Install Composer:
curl -s https://getcomposer.org/installer | php -
Add to your
composer.jsonfile:composer require alberon/htmltopdf
-
Usage Instructions:
// Require the PDF class at the top of the file require ABSPATH . '/../vendor/autoload.php'; use Alberon\htmltopdf\PDF; // Open up an ob buffer to capture all the following html ob_start(); // HTML CODE // Close the ob buffer and get the html into a variable $html = ob_get_clean(); // Setup the PDF class with the generated html $pdf = new PDF($html); // Set wkhtmltopdf version $pdf->setVersion('amd64'); // Set whether to include detailed errors or a generic error // $pdf->showErrors(); $pdf->hideErrors(); // Output the PDF $pdf->outputAsPDF('my_filename');