5

I'm using TCPDF to generate a PDF with text only.

First I've used multiCell to add the text, now I wanted to have two words become bold (somewhere in the middle in my text). So I changed my code to use writeHTML and surrounded i with b-tags, and voila the words are now blod. But at the same time my document size went from 41kB to 205kB which seems a little extreme.

Is there anyway to use inline blod formatting in the text without increasing the PDF size by 300%?

4

1 に答える 1

8

コメントで述べたように、Cell()またはを使用する前にフォントを変更してみてくださいMulticell()。例は次のとおりです。

$pdf=new PDF();
...
$pdf->Cell(180,10,'bla bla',0,1,'C');
$pdf->SetFont('Times','B',16);            //Change to bold
$pdf->Cell(180,10,'bla bla bla',0,1,'C'); //this printed in bold
$pdf->SetFont('Times','',12);             //Revert to plain font
$pdf->Cell(180,10,'bla bla bla',0,1,'C');
于 2012-10-09T10:32:13.250 に答える