1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?php
ini_set('display_errors',1);
error_reporting(E_ALL);
require 'vendor/autoload.php';
require 'vendor/mikehaertl/phpwkhtmltopdf/src/Pdf.php';
use mikehaertl\wkhtmlto\Pdf;
// You can pass a filename, a HTML string, an URL or an options array to the constructor
$pdf = new Pdf('01.html');
// On some systems you may have to set the path to the wkhtmltopdf executable
$pdf->binary = '/user/local/bin/wkhtmltopdf';
if (!$pdf->saveAs('01.pdf')) {
$error = $pdf->getError();
// ... handle error here
}
?> |
Partager