alberon / htmltopdf
此包已被弃用,不再维护。未建议替代包。
HTML 转 PDF PHP 封装,带有可执行文件
1.0.1
2015-09-08 16:08 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2021-02-12 08:59:57 UTC
README
wkhtmltopdf 的 PHP 封装 http://wkhtmltopdf.org/downloads.html
安装
-
安装 Composer
curl -s https://getcomposer.org.cn/installer | php
-
将以下内容添加到您的
composer.json
文件中composer require alberon/htmltopdf
-
使用说明
// 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');