0
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
0
<link href="prawn.css" rel="stylesheet" type="text/css" />
0
+<link href="twilight.css" rel="stylesheet" type="text/css" />
0
<h2>Building printable documents doesn't have to be hard</h2>
0
-<img src="
/media/prawn_logo.png" style="float: right;">
0
+<img src="
media/prawn_logo.png" style="float: right;">
0
If you've ever needed to produce PDF documents before, in Ruby or another language, you probably know how much it can suck. <span style="color: #eeff44"><b><i>Prawn takes the pain out of generating beautiful printable documents</b></i></span>, while still remaining fast, tiny and nimble. It is also named after a majestic sea creature, and that has to count for something.
0
@@ -43,8 +44,17 @@ a taste of what Prawn based programs looks like, <span style="color: #eeff44"><b
0
Internationalized text in Prawn is as simple as providing UTF-8 strings for it to render, assuming you've got a Unicode aware TTF font handy. For those who are running on Ruby 1.9, any encoding that can be converted to UTF-8 will work out of the box!
0
-<a href="media/utf8.pdf"><img src="media/utf8.png" style="padding-left: 1.5em;"/></a>
0
+<a href="media/utf8.pdf">
0
+<!-- begin dump from pastie.org/311073 -->
0
+ <pre class="textmate-source"><pre class="sunburst"><span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>Document</span></span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_with-arguments meta_function-call_method_with-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>generate</span></span>(<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"utf8.pdf"</span>) <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ font <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"<span class='source source_ruby source_ruby_embedded source_ruby_embedded_source'>#{<span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>BASEDIR</span></span>}</span>/data/fonts/DejaVuSans.ttf"</span>
0
+ text <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει."</span> <span class='keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby'>*</span> <span class='constant constant_numeric constant_numeric_ruby'>20</span>
0
+<span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+<!-- end pastie dump -->
0
<h3>-- Easy image embedding</h3>
0
@@ -52,7 +62,22 @@ Prawn makes embedding JPEG and PNG images a breeze. With support for alpha tran
0
including all the graphics you need in your documents.
0
-<a href="media/image.pdf"><img src="media/images.png" style="padding-left: 1.5em;"/></a>
0
+<a href="media/image.pdf">
0
+<!-- begin dump from pastie.org/311068 -->
0
+ <pre class="textmate-source"><pre class="sunburst"><span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>Document</span></span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_with-arguments meta_function-call_method_with-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>generate</span></span>(<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"image2.pdf"</span>, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:page_layout</span> => <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:landscape</span>) <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do </span>
0
+ pigs <span class='keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby'>=</span> <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"<span class='source source_ruby source_ruby_embedded source_ruby_embedded_source'>#{<span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>BASEDIR</span></span>}</span>/data/images/pigs.jpg"</span>
0
+ image pigs, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:at</span> => [<span class='constant constant_numeric constant_numeric_ruby'>50</span>,<span class='constant constant_numeric constant_numeric_ruby'>450</span>], <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:width</span> => <span class='constant constant_numeric constant_numeric_ruby'>450</span>
0
+ dice <span class='keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby'>=</span> <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"<span class='source source_ruby source_ruby_embedded source_ruby_embedded_source'>#{<span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>BASEDIR</span></span>}</span>/data/images/dice.png"</span>
0
+ image dice, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:at</span> => [<span class='constant constant_numeric constant_numeric_ruby'>50</span>, <span class='constant constant_numeric constant_numeric_ruby'>450</span>], <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:scale</span> => <span class='constant constant_numeric constant_numeric_ruby'>0.75</span>
0
+<span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+<!-- end pastie dump -->
0
<h3>-- Flexible table drawing</h3>
0
@@ -63,7 +88,27 @@ documents rather than forcing them to write a ton of low level graphics drawing
0
-<a href="media/fancy_table.pdf"><img src="media/tables.png" style="padding-left: 1.5em;"/></a>
0
+<a href="media/fancy_table.pdf">
0
+<!-- begin dump from pastie.org/311075 -->
0
+ <pre class="textmate-source"><pre class="sunburst"><span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>Document</span></span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_with-arguments meta_function-call_method_with-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>generate</span></span>(<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"fancy_table.pdf"</span>) <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ data <span class='keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby'>=</span> [[<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"Gregory Brown"</span>, <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"gregory.t.brown@fakemail.test"</span> ],
0
+ [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"James Healy"</span> , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"jimmy@fakemail.test"</span> ],
0
+ [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"Ross Perot"</span> , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"ross@fakemail.test"</span> ],
0
+ [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"Al Gore"</span> , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"al@fakemail.test"</span> ],
0
+ [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"Ralph Nader"</span> , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"ralph@fakemail.test"</span> ]]
0
+ <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:position</span> => <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:center</span>,
0
+ <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:headers</span> => [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"Name"</span>, <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"Email"</span>],
0
+ <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:row_colors</span> => [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"ffffff"</span>,<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"ffff00"</span>],
0
+ <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:vertical_padding</span> => <span class='constant constant_numeric constant_numeric_ruby'>5</span>,
0
+ <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:horizontal_padding</span> => <span class='constant constant_numeric constant_numeric_ruby'>3</span>
0
+<span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+<!-- end pastie dump -->
0
<h3>-- Simplified content positioning</h3>
0
@@ -74,7 +119,34 @@ Text can also be flowed within these sectioned off bounding boxes, so this
0
makes it trivial to generate columns of text on the fly.
0
-<a href="media/bounding_boxes.pdf"><img src="media/bounding_boxes.png"/></a>
0
+<a href="media/bounding_boxes.pdf">
0
+ <!-- begin dump from pastie.org/311081 -->
0
+ <pre class="textmate-source"><pre class="sunburst"><span class='support support_class support_class_ruby'>Prawn</span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>::<span class='entity entity_name entity_name_function entity_name_function_ruby'>Document</span></span><span class='meta meta_function-call meta_function-call_method meta_function-call_method_with-arguments meta_function-call_method_with-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>generate</span></span>(<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"bounding_boxes.pdf"</span>) <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do </span>
0
+ bounding_box [<span class='constant constant_numeric constant_numeric_ruby'>100</span>,<span class='constant constant_numeric constant_numeric_ruby'>600</span>], <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:width</span> => <span class='constant constant_numeric constant_numeric_ruby'>200</span> <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ text <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>"The rain in spain falls mainly on the plains "</span> <span class='keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby'>*</span> <span class='constant constant_numeric constant_numeric_ruby'>5</span>
0
+ stroke <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ line bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>top_left</span></span>, bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>top_right</span></span>
0
+ line bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>bottom_left</span></span>, bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>bottom_right</span></span>
0
+ <span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+ <span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+ bounding_box [<span class='constant constant_numeric constant_numeric_ruby'>100</span>,<span class='constant constant_numeric constant_numeric_ruby'>500</span>], <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:width</span> => <span class='constant constant_numeric constant_numeric_ruby'>200</span>, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:height</span> => <span class='constant constant_numeric constant_numeric_ruby'>200</span> <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ stroke <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ circle_at [<span class='constant constant_numeric constant_numeric_ruby'>100</span>,<span class='constant constant_numeric constant_numeric_ruby'>100</span>], <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:radius</span> => <span class='constant constant_numeric constant_numeric_ruby'>100</span>
0
+ line bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>top_left</span></span>, bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>bottom_right</span></span>
0
+ line bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>top_right</span></span>, bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>bottom_left</span></span>
0
+ <span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+ bounding_box [<span class='constant constant_numeric constant_numeric_ruby'>50</span>,<span class='constant constant_numeric constant_numeric_ruby'>150</span>], <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:width</span> => <span class='constant constant_numeric constant_numeric_ruby'>100</span>, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:height</span> => <span class='constant constant_numeric constant_numeric_ruby'>100</span> <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+ stroke_rectangle bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>top_left</span></span>, bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>width</span></span>, bounds<span class='meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby'>.<span class='entity entity_name entity_name_function entity_name_function_ruby'>height</span></span>
0
+ <span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+ <span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+<span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+ <!-- end pastie dump -->
0
<h3>-- And loads more to come</h3>