Answer the question
In order to leave comments, you need to log in
How to properly use the mpdf library in php (chrome bug)?
Here is the code that generates the pdf and opens it in the browser:
header("Content-Type: application/pdf");
header("Content-Disposition:inline;filename=\"invoice.pdf\"");
header("Content-Transfer-Encoding: binary");
ob_start();
include 'file.php';
$html = ob_get_contents();
ob_end_clean();
include("mpdf60/mpdf.php");
$mpdf = new mPDF('utf-8', 'A4', '12', '', 10, 10, 7, 7, 10, 10);
$stylesheet = file_get_contents('css/invoice.css'); //подключаем css
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->WriteHTML($html, 2); //формируем pdf
$mpdf->Output('file.pdf', 'I');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question