Is there an alternative to TCPDF :: writeHTML to get inline bold text

I use TCPDF to create a PDF file with text only.

At first I used multiCell to add text, now I wanted the two words to become bold (somewhere in the middle in my text). Therefore, I changed my code to use writeHTML and I surrounded with b-tags, and voila words are now blobs. But at the same time, the size of my document ranged from 41 KB to 205 KB, which seems a bit extreme.

Is it possible to use string block formatting in text without increasing PDF size by 300%?

+4
source share
1 answer

As I said in the comments, try changing the font before using Cell() or Multicell() , an example follows:

 $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'); 
+7
source

Source: https://habr.com/ru/post/1436110/


All Articles