Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The sample you are refering to, from the prawnto plugin, is using an older version of prawn.</p> <p>Since i also needed header and footer i looked a bit more into this. It seems that that version of prawn had header and footer methods, which were implemented using lazy bounding box. (found by checking the code on github)</p> <p>In the new prawn version you can do the same thing using repeaters.</p> <p>Here is the full sample rewritten using the new version:</p> <pre><code>require "#{File.dirname(__FILE__)}/../example_helper.rb" Prawn::Document.generate("test.pdf") do repeat :all do # header bounding_box [bounds.left, bounds.top], :width =&gt; bounds.width do font "Helvetica" text "Here's My Fancy Header", :align =&gt; :center, :size =&gt; 25 stroke_horizontal_rule end # footer bounding_box [bounds.left, bounds.bottom + 25], :width =&gt; bounds.width do font "Helvetica" stroke_horizontal_rule move_down(5) text "And here's a sexy footer", :size =&gt; 16 end end bounding_box([bounds.left, bounds.top - 50], :width =&gt; bounds.width, :height =&gt; bounds.height - 100) do text "this is some flowing text " * 200 move_down(20) font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf" table [["ὕαλον ϕαγεῖν", "baaar", "1" ], ["This is","a sample", "2" ], ["Table", "dont\ncha\nknow?", "3" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules\nwith an iron fist", "x" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ], [ "It", "Rules", "4" ]], :font_size =&gt; 24, :horizontal_padding =&gt; 10, :vertical_padding =&gt; 3, :border_width =&gt; 2, :position =&gt; :center, :headers =&gt; ["Column A","Column B","#"] end end </code></pre> <p>you can check the documentation page of repeat for other options which allow you to exactly specify where you want the repeaters.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload