<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require 'vendor/autoload.php'; use Knp\Snappy\Pdf; $snappy = new Pdf('C:\"Program Files"\wkhtmltopdf\bin\wkhtmltopdf.exe'); $url1 = "https://www.google.com/?q=wkhtmltopdf"; $url2 = "https://www.google.com/?q=snappy"; $url3 = "https://www.google.com/?q=php-html-to-pdf"; header('Content-Type: application/pdf'); // https://github.com/KnpLabs/snappy/blob/master/src/Knp/Snappy/Pdf.php#L78 $snappy->setOption('margin-top', '0px'); $snappy->setOption('margin-bottom', '0px'); $snappy->setOption('margin-left', '0px'); $snappy->setOption('margin-right', '0px'); $snappy->setOption('dpi', '300'); // 300 DPI A4 Size = 297mm*210mm / 3508px*2480px echo $snappy->getOutput([$url1,$url2,$url3]);
喜歡這篇文章嗎?
(暫時未有評分)
Loading...
(暫時未有評分)
Loading...