mpdf
mpdf (4.0k β) is a library to create PDF files.
$ composer require mpdf/mpdf
You can use the given code sample to test your installation.
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output();
Example using a heredoc and downloading a file:
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML(
<<<HTML
<!-- you can use PHP variables and there is no need to
escape quotes within a HEREDOC clause -->
HTML
);
// Download the PDF as a file, close the tab
$mpdf->OutputHttpDownload("filename");