PHP code example of dpsoft / php-html-to-pdf
1. Go to this page and download the library: Download dpsoft/php-html-to-pdf library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dpsoft / php-html-to-pdf example snippets
use Dpsoft\HtmlToPdf\Converter;
$converter = new Converter();
// export to pdf
$convertor->setUrl('http://google.com')->toPdf('pdf/file/name.pdf');
// or export to png
$convertor->setUrl('http://google.com')->toPng('png/file/name.png');
// you can set window size for png export
$convertor->setUrl('http://google.com')->setWindow(1280,960)->toPng('png/file/name.png');