Skip to content
PHP Logo

Is there a specific function like SetCharSpacing in FPDF that needs to be implemented for adjusting font width?

To adjust the font width in FPDF, you can use the SetStretching method which allows you to set the horizontal scaling of the current font. This can be used to increase or decrease the width of the characters in the text being displayed.

php
// Adjust font width using SetStretching method in FPDF
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
$pdf->SetStretching(150); // Increase font width by 50%
$pdf->Cell(0,10,'Adjusting font width using SetStretching method',0,1);
$pdf->Output();