I’m using Prawn to generate my PDF files from a HTML source. This HTML contains only some basic formatting, such as bold, italic, underlines, ordered and unordered lists. For the first three, Prawn will take care of using :inline_format => true in the text command.
How do I tell Prawn to understand uland ol tags and turn them into lists in the PDF file? I understand I should use some helper. Anyone has faced this before?
Thanks!
As such, Prawn does not provide an in-built HTML parse and hence, it won’t know what the
ulandlitags mean. Prawn’s Text-box might be the closest option.EDIT:
—
To this end, here is a small, feasible implementation:
Say the html string is
<ul><li>First line</li><li>Second line</li></ul>Using any Ruby HTML parser, you can parse the lines. Here I’ve used Nokogiri.
—
It would be a lot easier to use a html to pdf conversion gems to achieve this. Take a look at WickedPDF project.