Reputation: 466
I'm using prawn to generate pdfs.
In one of my tables, I would like to insert a checkmark via html code (ascii) -> [☒ or ☐].
I tried to use HTMLEntities gem but doesn't work in views, just on IRB. And html_safe either.
On the pdf, there is just a '_' character (underscore).
I'm am in utf-8.
Any ideas why? Is there another solution?
Upvotes: 1
Views: 835
Reputation: 114178
This is because your font doesn't include these glyphs. Use a font that does:
require 'prawn'
Prawn::Document.generate('checkmarks.pdf') do |pdf|
pdf.font("/Library/Fonts/Arial Unicode.ttf") # adjust font path
pdf.text("☒ ☐")
end
Upvotes: 2