I'm trying to use grids to create ads within a page. Lets say I have a page with 5 columns and 5 rows.
I'd like to dynamically calculate the size of each subsequent box within the grid so I can - for instance - use an image to fit the whole width of the box. I've tried the following:
Prawn::Document.generate("test.pdf") do |pdf|
pdf.define_grid(:columns => 5, :rows => 5, :gutter => 10)
pdf.grid(7, 1).bounding_box do
pdf.stroke_bounds
pdf.text "Some text"
pdf.image open("image_url"), :fit => [dynamic_size, dynamic_size]
end
end
Ideally I'd like the ability to use percentage in the
parameters (or a method to calculate this percentage on the fly).
Any ideas how can I achieve this?
Thanks in advance!