PHP code example of spiritix / html-to-pdf
1. Go to this page and download the library: Download spiritix/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/ */
spiritix / html-to-pdf example snippets
use Spiritix\HtmlToPdf\Converter;
use Spiritix\HtmlToPdf\Input\UrlInput;
use Spiritix\HtmlToPdf\Output\DownloadOutput;
$input = new UrlInput();
$input->setUrl('https://www.google.com');
$converter = new Converter($input, new DownloadOutput());
$converter->setOption('n');
$converter->setOption('d', '300');
$converter->setOptions([
'no-background',
'margin-bottom' => '100',
'margin-top' => '100',
]);
$output = $converter->convert();
$output->download();