我正在研究fpdf以创建pdf
我使用以下代码:
$pdf = new tFPDF();
$questions = $_POST['question'];
$count = count($questions);
$quests = "";
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',14);
$pdf->SetTextColor(50,60,100);
$pdf->AddPage('P');
$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, iconv('UTF-8', 'windows-1252', $questf)."\n"); if($get_q[0]->image !=='') { $pdf->Ln(); $path = plugins_url(); $imagenurl = $path.'/roque/uploads/'.$get_q[0]->image; $pdf->Cell(0, 10, $pdf->Image($imagenurl,$pdf->GetX()+60, $pdf->GetY() + 5,50,50), 0, 0, 'L',''); }
$questf = "Option 1 : ".$get_q[0]->op1;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$questf = "Option 2 : ".$get_q[0]->op2;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$questf = "Option 3 : ".$get_q[0]->op3;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$questf = "Option 4 : ".$get_q[0]->op4;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$pdf->Ln();
$pdf->Ln();
}
pdf已创建,但当我显示pdf时,会在该行的末尾创建一个小方框,pdf的示例为:
http://www.provarapida.net.br/wp-content/plugins/roque/pdfs/03102015121244_q.pdf
如何删除这些框???
答案 0 :(得分:0)
删除&#34; \ n&#34;在你的字符串的末尾。 Cell()不支持多行,tFPDF似乎不正确地将字符子集化为缺少的字形字符。