Answer the question
In order to leave comments, you need to log in
After downloading pdf how to translate to another page?
header("Content-Type: application/pdf");
header("Content-Disposition:inline;filename=\"invoice.pdf\"");
header("Content-Transfer-Encoding: binary");
ob_start();
include 'pdfInvoice.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('invoice'.$_POST['id'].'.pdf', 'D');
header("Location: /invoice/1");
Answer the question
In order to leave comments, you need to log in
We read mana , there in the very first sentence it is written, "that the header () function can be called only if the client has not yet received data." The option that suits you is in the first example on the same page: "Content-Disposition: attachment;" tells the browser to "download, don't open", but when the download has started, redirect the js.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question