views:

341

answers:

1

I'm a little stuck on using Prawn/Prawnto to generate PDF documents. The Prawn documentation has helped some, but the Prawnto documentation is seemingly offline these days.

I am trying to find a way to space text cells based on the previous cell's height. Prawn has the methods to do this -- no problem, but the return value from doing pdf.cell (even though it generates a cell) is a Prawn bounding block -- essentially the page.

How can I do something similar to below and get the height of the cell, not of the bounding box?

offer = pdf.cell [220, 680], :text => @reward.offer, :width => 250, :font_size => 14
pitch = pdf.cell [220, offer.height - 20], :text => offer.height, :width => 250, :font_size => 12
rules = pdf.cell [220, pitch.height - 20], :text => pitch.height, :width => 250, :font_size => 12
+1  A: 

In this case, you're not really hitting prawnto, it just ties prawn into rails better.

All the layout and formatting is done in prawn and prawn-format and prawn-layout (rdoc for those). The docs are a little spaghetti-link at times.

wesgarrison