The Whiz of Oz
The Whiz of Oz

Reputation: 7043

Can't print line breaks with Rails and Wicked PDF

My original text

test\r\n\r\ntest\r\n\r\ntest

View:

p = @property.data

Result in PDF

test test test

I need instead:

test

test

test

Upvotes: 1

Views: 1065

Answers (1)

Charith H
Charith H

Reputation: 355

Try using simple_format to convert line breaks to html new line tags. This works well with pdf too.

<%= simple_format p %>

Note: If you are using rich text editor (such as trix_editor) .html_safe will work with line breaks. But in this case, .html_safe doesn't work in PDFs.

Upvotes: 3

Related Questions