public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
changed code snippets to actual text from images
cbartlett (author)
Sun Nov 09 17:28:23 -0800 2008
commit  631d2dbf237c7bc5eb0d80b78550d7568017dc7a
tree    585775fed5d7cf1d0fe2600a806d056871baf7f7
parent  8f6d50c7a5bddfb4d4b2c814bad30947baa234e9
...
4
5
6
 
7
8
9
...
26
27
28
29
 
30
31
32
...
43
44
45
46
47
 
 
 
 
 
 
 
 
 
 
 
48
49
50
...
52
53
54
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
57
58
...
63
64
65
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
68
69
...
74
75
76
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
79
80
...
4
5
6
7
8
9
10
...
27
28
29
 
30
31
32
33
...
44
45
46
 
 
47
48
49
50
51
52
53
54
55
56
57
58
59
60
...
62
63
64
 
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
88
89
90
 
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
...
119
120
121
 
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
0
@@ -4,6 +4,7 @@
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
 </head>
0
 <body> 
0
 
0
@@ -26,7 +27,7 @@
0
 </div>
0
 
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
 <p>
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
 </p>
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
 </p>     
0
 
0
-<a href="media/utf8.pdf"><img src="media/utf8.png" style="padding-left: 1.5em;"/></a>
0
-         
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'>&quot;utf8.pdf&quot;</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'>&quot;<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&quot;</span>
0
+  text <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.&quot;</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
+</pre></pre>
0
+
0
+<!-- end pastie dump -->
0
+</a>
0
+
0
 <h3>-- Easy image embedding</h3>
0
   
0
 <p>
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
 </p>  
0
 
0
-<a href="media/image.pdf"><img src="media/images.png" style="padding-left: 1.5em;"/></a>  
0
+<a href="media/image.pdf">
0
+
0
+<!-- begin dump from pastie.org/311068 -->
0
+
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'>&quot;image2.pdf&quot;</span>, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:page_layout</span> =&gt; <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'>&quot;<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&quot;</span> 
0
+  image pigs, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:at</span> =&gt; [<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> =&gt; <span class='constant constant_numeric constant_numeric_ruby'>450</span>                                      
0
+
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'>&quot;<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&quot;</span>
0
+  image dice, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:at</span> =&gt; [<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> =&gt; <span class='constant constant_numeric constant_numeric_ruby'>0.75</span> 
0
+<span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+</pre></pre>
0
+
0
+<!-- end pastie dump -->
0
+
0
+</a>
0
 
0
 <h3>-- Flexible table drawing</h3>
0
 
0
@@ -63,7 +88,27 @@ documents rather than forcing them to write a ton of low level graphics drawing
0
 code.
0
 </p>   
0
 
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
+
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'>&quot;fancy_table.pdf&quot;</span>) <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do</span>
0
+
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'>&quot;Gregory Brown&quot;</span>, <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;gregory.t.brown@fakemail.test&quot;</span> ],
0
+          [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;James Healy&quot;</span>  , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;jimmy@fakemail.test&quot;</span>           ],
0
+          [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;Ross Perot&quot;</span>   , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;ross@fakemail.test&quot;</span>            ],
0
+          [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;Al Gore&quot;</span>      , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;al@fakemail.test&quot;</span>              ],
0
+          [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;Ralph Nader&quot;</span>  , <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;ralph@fakemail.test&quot;</span>           ]]
0
+
0
+  table data,
0
+    <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:position</span>           =&gt; <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>            =&gt; [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;Name&quot;</span>, <span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;Email&quot;</span>],
0
+    <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:row_colors</span>         =&gt; [<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;ffffff&quot;</span>,<span class='string string_quoted string_quoted_double string_quoted_double_ruby'>&quot;ffff00&quot;</span>],
0
+    <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:vertical_padding</span>   =&gt; <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> =&gt; <span class='constant constant_numeric constant_numeric_ruby'>3</span>
0
+<span class='keyword keyword_control keyword_control_ruby'>end</span>
0
+</pre></pre>
0
+<!-- end pastie dump -->
0
+</a>   
0
 
0
 <h3>-- Simplified content positioning</h3>
0
                                                         
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
 </p>              
0
 
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'>&quot;bounding_boxes.pdf&quot;</span>) <span class='keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block'>do   </span>
0
+
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> =&gt; <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'>&quot;The rain in spain falls mainly on the plains &quot;</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
+
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> =&gt; <span class='constant constant_numeric constant_numeric_ruby'>200</span>, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:height</span> =&gt; <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> =&gt; <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
+
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> =&gt; <span class='constant constant_numeric constant_numeric_ruby'>100</span>, <span class='constant constant_other constant_other_symbol constant_other_symbol_ruby'>:height</span> =&gt; <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
+  </pre></pre>
0
+
0
+  <!-- end pastie dump -->  
0
+</a>
0
 
0
 <h3>-- And loads more to come</h3>
0
 

Comments