Question

I'm creating a simple PDF in Rails 3 using Prawn/Prawnto. I'm not sure if my issue is related to Prawnto or if it's just the way i'm doing it. The following code is in my view.

This will successfully output a table:

pdf.table([%w[foo boo], %w[bar baz]])

But I have requirements that I need to inspect certain cells of data and if they match some criteria I must then turn the text red. Now I know the following snippet doesn't describe the requirements but it's an example where I've found out that nothing is evaluated in the initializer block.

Doesn't work

pdf.table([%w[foo boo], %w[bar baz]]) do |t|
  t.column(0).width = 200
end

The above snippet will output my table just like before but the first column isn't 200 width. It seems no matter what I put after the do it doesn't get evaluated. I've put complete junk and it will still just output my table with no errors or warnings. I've seen examples where this is possible using straight Prawn without the Prawnto plugin but didn't know if this was a limitation of Prawnto or if I'm doing something wrong.

Any ideas what I'm doing wrong?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top