How can render HTML content from database in a prawn document
class PdfReport < Prawn::Document
def initialize user
super()
text user.description #=> "<p>It's an html content</p>"
end
end
The output i am getting from the above code is a string with HTML tags. I want something like html_safe. Is it possible in Prawn?
The html paragraph tag doesn't work in prawn. If you're looking for how to create a separation between paragraphs, see https://stackoverflow.com/a/49683036 which shows how to vertically measure text boxes (and formatted text boxes) and move the cursor accordingly.
But prawn can interpret some html tags such as bold:
text s, :inline_format => true #It's an html content