-->

How to generate pdf file using dompdf and redirect

2019-08-07 11:37发布

问题:

Hi I am making an online shopping site where in the admin control panel I need to generate the invoices. I have done it successfully using dompdf and PDF files are being generated successfully and are downloaded in download folder. Now I have one problem. After generating the PDF file, I want to redirect to another page. Below is my code. This code is generating the PDF file bbut not redirecting to the specified page. Please help on this issue that how can I redirect ? All your help will be highly appreciated.

Thanks & regard,

This is the code :

require_once('dompdf/dompdf_config.inc.php');

if ( isset( $_POST["html"] ) ) {

  if ( get_magic_quotes_gpc() )
    $_POST["html"] = stripslashes($_POST["html"]);

  $old_limit = ini_set("memory_limit", "-1");
  $dompdf = new DOMPDF();
  $dompdf->load_html($_POST["html"]);
  $dompdf->set_paper("letter", "portrait");
  $dompdf->render();
  $dompdf->stream("invoice.pdf");
  header('location:orders.php');
exit();
}