问题描述
我已将所有 pdf 的字体大小设置为 10,问题是如果我想更改 pdf 特定区域的字体大小而不更改所有字体大小,可以吗?看下面的代码,我想改变这些区域的字体大小 $pdf->SetXY(17,80) ;
<?PHP
require_once('../../bus_partners/fpdf/fpdf/fpdf.PHP');
require_once('../../bus_partners/fpdf/fpdi/fpdi.PHP');
$pageCount = $pdf->setSourceFile('../../bus_partners/BIR-forms/2316.pdf') ;
$tplIdx = $pdf->importPage(1,'/MediaBox');
$pdf->SetAutopageBreak(false) ;
$pdf->addPage('P','Legal') ;
$pdf->useTemplate($tplIdx,8,12,200,320) ;
// setting the font size for the whole page
$pdf->SetFont('Arial');
$pdf->SetFontSize(9);
$pdf->SetTextColor(12,12);
// Can I set the font size in this specific area only ?
$pdf->SetXY(17,80) ;
$pdf->Write(0,$address_ee) ;
?>
解决方法
就这样做:
<?php
...
$pdf->SetFont('Arial','B',14);
$pdf->SetXY(17,80) ;
$pdf->Write(0,$address_ee) ;
...
?>
您可以在这里看到 setFont 的设置: http://www.fpdf.org/en/doc/setfont.htm