【发布时间】:2015-04-17 22:25:04
【问题描述】:
我正在开发一个 wordpress 插件,
我想创建一个 pdf 文件,为此我使用了fpdf
通过使用此代码,我可以生成 pdf 并将其保存到服务器
require('fpdf/html_table.php');
$pdf=new PDF_HTML();
$questions = $_POST['question'];
$count = count($questions);
$quests = "";
$pdf->SetFont('times','',12);
$pdf->SetTextColor(50,60,100);
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
$pdf->SetFontSize(12);
for($i=1;$i<=$count;$i++)
{
$qus_id = $questions[$i-1];
$get_q = "select * from `SelleXam_question` where `id`='$qus_id'";
$get_q = $wpdb->get_results($get_q);
$questf = "Quest $i : ".$get_q[0]->question;
$pdf->Cell(0, 10, $questf."\n");
$pdf->Ln();
}
$dir='C:/wamp/www/';
$filename= "filename.pdf";
$pdf ->Output($dir.$filename);
echo "Save PDF in folder";
但是当它保存并显示消息Save PDF in Folder时。我是unable to see the header part of the wordpress website.
或者当我使用时
$pdf->Output($filename,'D');
那么有什么方法可以在链接中显示文件
【问题讨论】: