【问题标题】:mpdf is direct downloading webservermpdf是直接下载网络服务器
【发布时间】:2013-06-18 14:53:54
【问题描述】:

我正在使用 mpdf 在 PHP 中生成 pdf 报告,当我使用 XAMPP 在开发 PC 上进行测试时,pdf 报告显示在浏览器中,但是当我将它托管到网络服务器时,它没有在浏览器中打开并开始下载.

这是我的代码

include("mpdf/mpdf.php");
$mpdf=new mPDF();
$html = 'some html'
$mpdf->WriteHTML($html);
$mpdf->mirrorMargins = 1;
$mpdf->SetDisplayMode('fullwidth','continuous');
$mpdf->output();
exit();

网络服务器出了什么问题???

编辑

我发现这是由于安装了IDM,如何防止IDM下载文件

【问题讨论】:

标签: php tcpdf mpdf


【解决方案1】:

可能是服务器发送了不同的头部信息。

// set these two header to open the file in your browser
header("Content-Type: application/pdf");
header("Content-Disposition: inline; yourfilename.pdf");

include("mpdf/mpdf.php");
$mpdf=new mPDF();
$html = 'some html'
$mpdf->WriteHTML($html);
$mpdf->mirrorMargins = 1;
$mpdf->SetDisplayMode('fullwidth','continuous');
$mpdf->output();
exit();

【讨论】:

    猜你喜欢
    • 2021-11-16
    • 1970-01-01
    • 2020-12-18
    • 1970-01-01
    • 2015-07-12
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    • 2013-03-23
    相关资源
    最近更新 更多