Topic: Prawn: 2 grids on 1 page

Hello,

As you may know, I am creating an array of labels with Prawn. On each label some text and a barcode should be printed. I'm able to make this:

http://img863.imageshack.us/i/rensetiketblanco.png/

But now, I would like to make this:

http://img818.imageshack.us/i/printlakeside.png/

This is not an 'endless array', but there is some whitespace in between two rows. On the lower rows the text and barcode should be rotated 180 degrees.

Here's some code of the first pdf:


----------------------------------------------


pdf = Prawn::Document.new(:page_size => "A3", :page_layout => :portrait, :margin => 22)

pdf.define_grid(:columns => 8, :rows => 5, :column_gutter => 0, :row_gutter => 0)

i = 0

@order.lineitems.each do |lineitem|

  lineitem.quantity.times do       
 
    pos = i % 40                    # pos = label's position on the page (0-39)   
   
    box = pdf.grid(pos / 8, pos % 8)    # lay labels out in 4 columns
    # (print label in box)       

    pdf.start_new_page if pos == 0

    pdf.bounding_box box.top_left, :width => box.width, :height => box.height do         

      pdf.draw_text "LTB", :at => [10,170], :size => 15, :style => :bold   

      pdf.draw_text lineitem.label.product_number, :at => [88,182], :rotate => 270, :style => :bold           

      pdf.draw_text "SIZE", :at => [10,120], :size => 7, :style => :bold
      pdf.draw_text lineitem.label.size, :at => [10,112], :size => 7 

      pdf.draw_text "COLOR", :at => [62,120], :size => 7, :style => :bold
      pdf.draw_text lineitem.label.color_number, :at => [62,112], :size => 7

      #generate barcode with Barby library 
      lineitem.label.barcode.annotate_pdf(pdf, :xdim => 0.5, :height => 40, :x => 25, :y => 60)

      #generate EAN-code underneath the barcode
      pdf.draw_text lineitem.label.ean.to_s, :at => [23,51], :size => 7                               
   
    end     
   
    i += 1
   
  end     
 
end


----------------------------------------------

Any help would be greatly appreciated!

Rens