2013-11-04 97 views
0

我有一个代码下面成功下载.pdf文件,但是当我打开文件时,它总是显示一条错误消息。这是我的代码: include(“MPDF57/mpdf.php”);无法打开我的下载PDF

$mpdf=new mPDF('c','A4','','',32,25,27,25,16,13); 
$mpdf->SetDisplayMode('fullpage'); 
$mpdf->showImageErrors = true; 

$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list  

$html='<html><head></head><body>Test</body></html>'; //Assign HTML HERE  

$mpdf->WriteHTML($html); 
$mpdf->Output('Certificate.pdf','D');  

请帮忙,请提前致谢。

+0

我已经包括了这个库。 –

+0

用记事本或类似的文本编辑器打开你的文件,这显然不是一个合适的PDF文件,它将包含错误信息。 –

+0

'include'用于应该加载和执行的PHP脚本。您应该链接到PDF生成器PHP脚本。 –

回答

1

use header(“Content-type:application/pdf”);

0

试试这个one..will帮助你..

http://stackoverflow.com/questions/9248510/working-with-pdf-in-php