I'm stuck with a problem when trying to generate a document using [Prawn](http://prawnpdf.org/api-docs/2.0/) gem for Rails

What I'm trying to do is to set a variable height for my pdf, so depending on some queries in the database, the PDF height will change. I'm doing this because I need a single page PDF document.

Currently, my code looks like this:

```
pdf = Prawn::Document.new(page_size: [297.64, 419.53], margin: 0)

....

data = [ ["Header1", "Header2", "Header3", "Header4", "Header5", "Header6"] ]

// here is the variable data
cart.cart_products.each do |cp|
  arr = [
    cp.product_code,
    cp.product_description,
    cp.amount,
    cp.product_metric,
    cp.product_unit_value,
    cp.total_value
  ]

  data.push(arr)
end

// populating the table with data
pdf.table(data, :cell_style => {:border_width => 0}, :column_widths => [45, 80, 30, 42.36, 50, 50]) do |table|
  table.row(0).border_width = 0.1.mm
  table.row(0).font_style = :bold
  table.row(0).borders = [:bottom]
end

....

pdf.render_file("path/to/dir/document.pdf")

```

Can anyone help me with this? Thanks.