I\'m generating some PDF file on the fly using PHP. My problem is I need to insert line breaks in some part of the text that will be inserted in the PDF file. Something like
Another option is to use TCPDF::Ln(). It adds a line to the PDF with the option to set the height.
If the newlines are within your content already then MultiCell() is probably the way to go, as others have mentioned, but I find I like using:
$pdf->Cell(0, 0, 'Line 1', 0, 0, 'C');
$pdf->Ln();
$pdf->Cell(0, 0, 'Line 2', 0, 0, 'C');
It confuses me that Cell() and MultiCell() take in different arguments so I tend to stick to using Cell() only. Also it reads like a newline character for the PDF the same as \n
reads like a newline character in text or
in HTML.