trojan
trojan

Reputation: 53

How to display new line on blade when generating PDF using DomPDF?

I want to display the text in separate lines when generate PDF using DomPDF.

I have tried: {{ nl2br($text) }} and {{ nl2br(e($text)) }}, but not working.

{{ $text }}

Current result:
This is the first line. This is the second line. This is the third line.

Expected result:
This is the first line.
This is the second line.
This is the thid line.

Upvotes: 0

Views: 4541

Answers (2)

trojan
trojan

Reputation: 53

It works as below:

{!! nl2br(e($text)) !!}

Upvotes: 4

SenilShah
SenilShah

Reputation: 146

While generating the text for your pdf, after every statement, add <br> or <br/>.

I think this will fullfill your need.

Upvotes: 3

Related Questions