Looking for example creating a bulleted list/tree

171 views
Skip to first unread message

Chris W.

unread,
Nov 4, 2009, 11:19:50 AM11/4/09
to Prawn
I am looking to create a PDF that just contains a bulleted list
(multiple levels) and wondering if this is built-in to Prawn. I
looked under prawn-layout and prawn-format and didn't see anything
jump out at me. If not, does anyone have an example they might care
to share? Just trying to not reinvent the wheel...

Thanks!
Chris

Gregory Brown

unread,
Nov 4, 2009, 11:29:49 AM11/4/09
to prawn...@googlegroups.com

Maybe you didn't come across this document?
http://jamis.github.com/prawn-format/

It'll take some tweaking to get it to work right, but as long as you
use a Unicode aware TTF font, something like this will work:

require "prawn"
require "prawn/format"
Prawn::Document.generate("bull.pdf") do
font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
text "&bull; A<br/>&bull; B<br/>&bull; C<br/>"
end

Read up on Prawn::Format as to how you can make that nicer. I
actually haven't used it extensively and mainly only babysit that
code.

-greg

Reply all
Reply to author
Forward
0 new messages