TCPDF icon indicating copy to clipboard operation
TCPDF copied to clipboard

How can I let \n become new line in tcpdf with html

Open gangli66 opened this issue 1 year ago • 2 comments

I use php and laravel to create an PDF by TCPDF. My code is like this:

...

{{ $myvalue }}

... But when $myvalue has some \n, it does not wrap to new line and all words are in the same line. I change \n to
or
before it render the pdf, but it display
or
without wrapping to new line.

gangli66 avatar Nov 01 '24 10:11 gangli66

I change \n to

What did you change \n to? Did you use HTML like <br>? That should work.

littlepackage avatar Nov 15 '24 14:11 littlepackage

There is handy function called nl2br. Use it to convert \n to <br/>, otherwise it will not work anywhere, as it's not related to this particular package

Justinas-Jurciukonis avatar Jan 06 '25 09:01 Justinas-Jurciukonis