2013-11-04 124 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