I have a 6 column quote form which I build using fpdf using the MultiCell feature. My issue is that in the 3rd column I have the description which has multiple lines of text that need a line break. You can see that replacing the html entity with \n only prints the character \n. I have tried it in quotes both single and double and tried CHR(10), it doesn't matter it treats the description as a string and outputs the string.
The data for the column "description" is in html string:
$description = "205 - Base Cap 0.717 X 3.11<br>Cypress #2<br>Mill finish<br>Exact<br>Sand<br>Kerf<br>End dado 2.625" below dado.<br>Prepare for flush bolt HW-24EFB10B<br>10/10 80/3";
To create the row I use the following code:
$description = str_replace('<br>','\n',$description);
$pdf->Row(array($itemNumber,$stk_code,$description,$quantity,$unit_price,$lineNet));
Which calls the Row function to create a MultiCell row:
var $widths;
var $aligns;
function SetWidths($w)
{
//Set the array of column widths
$this->widths=$w;
}
function SetAligns($a)
{
//Set the array of column alignments
$this->aligns=$a;
}
function Row($data)
{
//Calculate the height of the row
$nb=0;
for($i=0;$i<count($data);$i++)
$nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
$h=15*$nb;
//Issue a page break first if needed
$this->CheckPageBreak($h);
//Draw the cells of the row
for($i=0;$i<count($data);$i++)
{
$w=$this->widths[$i];
$a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
//Save the current position
$x=$this->GetX();
$y=$this->GetY();
//Draw the border
$this->Rect($x,$y,$w,$h);
//Print the text
$this->MultiCell($w,15,$data[$i],0,$a);
//Put the position to the right of the cell
$this->SetXY($x+$w,$y);
}
//Go to the next line
$this->Ln($h);
}
I have also tried WriteHTML but it returns the text less any html entities visible on screen.
',"\n",$description); And it works a big thank you to you. – user1946891 May 16 '17 at 19:21