Make text wrap in a cell with FPDF?

Text Wrap: The MultiCell is used for print text with multiple lines. It has the same atributes of Cell except for ln and link. $pdf->MultiCell( 200, 40, $reportSubtitle, 1); Line Height: What multiCell does is to spread the given text into multiple cells, this means that the second parameter defines the height of each line … Read more

FPDF error: Some data has already been output, can’t send PDF

For fpdf to work properly, there cannot be any output at all beside what fpdf generates. For example, this will work: <?php $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont(‘Arial’,’B’,16); $pdf->Cell(40,10,’Hello World!’); $pdf->Output(); ?> While this will not (note the leading space before the opening <? tag) <?php $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont(‘Arial’,’B’,16); $pdf->Cell(40,10,’Hello World!’); $pdf->Output(); … Read more

FPDF utf-8 encoding (HOW-TO)

Don’t use UTF-8 encoding. Standard FPDF fonts use ISO-8859-1 or Windows-1252. It is possible to perform a conversion to ISO-8859-1 with utf8_decode(): $str = utf8_decode($str); But some characters such as Euro won’t be translated correctly. If the iconv extension is available, the right way to do it is the following: $str = iconv(‘UTF-8’, ‘windows-1252’, $str);