How to generate pdf with save asking and redirect to another page?

865 views Asked by At

I'm not sure how to explain my problem straight. I have form which is sending to database by clicking submit button. What I want is to generate pdf from my form after click on submit button. It should confirm about save this pdf and after click save or cancel it should redirect to another page. I tried this code, but it doesn't do what I want:

$mytext='text from textarea';
include('css/pdf/MPDF57/mpdf.php');
$mpdf=new mPDF();
$htmlbuffer = $mytext;
$mpdf->WriteHTML($htmlbuffer);
$mpdf->SetTitle('Uwagi do planu');
$mpdf->SetAuthor('Name Surname');
$mpdf->Output("test.pdf");
header("Pragma: public");

header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=test.pdf");
header("Content-Transfer-Encoding: binary");
readFile("test.pdf");
header("Location: index.php?p=info");
0

There are 0 answers