Changing the default filename when using mPDF

懵懂的女人 提交于 2019-12-01 03:12:56

Try the I flag in the Output function, which will output the PDF to the browser, and use the filename from the first argument:

$payStub=new mPDF();
$payStub->SetTitle('My title');
$payStub->WriteHTML($pcTableRows);
$payStub->Output('yourFileName.pdf', 'I');

You can try as:

$file_name = 'yourFileName.pdf';
$mpdf->Output($file_name, 'D');

Help:

  1. 'D': download the PDF file
  2. 'I': serves in-line to the browser
  3. 'S': returns the PDF document as a string
  4. 'F': save as file $file_out
Julian

Modify mdpdf.php

form.setAttribute("action", "'._MPDF_URI.'includes/out.php/'.$name.'");

for downloading with other name

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