How to generate pdf file using dompdf and redirect to another page

六月ゝ 毕业季﹏ 提交于 2019-12-11 08:27:59

问题


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();
}

来源:https://stackoverflow.com/questions/27815663/how-to-generate-pdf-file-using-dompdf-and-redirect-to-another-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!