How To Create Pdf With Doompdf In Php

[Solved] How To Create Pdf With Doompdf In Php | Lisp - Code Explorer | yomemimo.com
Question : how to create pdf with doompdf in php

Answered by : dark-dragonfly-raix2x12s5a7

<?php
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$html = '<h1 style="color:blue;">Hello World!</h1><p>A PDF generated by DomPDF library.</p>';
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
// write pdf to a file
$pdf = $dompdf->output();
file_put_contents("newfile.pdf", $pdf);
?>

Source : https://www.kodingmadesimple.com/2018/03/convert-html-to-pdf-php-dompdf.html | Last Update : Fri, 24 Dec 21

Answers related to how to create pdf with doompdf in php

Code Explorer Popular Question For Lisp