Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

is before_rendering_page work for table #397

Closed
batizhevsky opened this Issue Sep 1, 2012 · 4 comments

Comments

Projects
None yet
3 participants

In manual (page 101) shown example of using before_rendering_page for borders of table.
I try to use it, but it now work for me.
Page long-long show loading cycle, but then i press ctrl-c in console rails says me:

NoMethodError (undefined method before_rendering_page' for #<Prawn::Table:0x007ff113ee8138>): app/prices/pricelist.rb:40:inblock in to_pdf'
prawn (0.12.0) lib/prawn/table.rb:128:in instance_eval' prawn (0.12.0) lib/prawn/table.rb:128:ininitialize'
prawn (0.12.0) lib/prawn/table.rb:25:in new' prawn (0.12.0) lib/prawn/table.rb:25:intable'

anybody can help me, please?

Oh, I use stable version from gem, but this functional only in master. Sorry.
But still the example is not working for me.

table([[head], *(data.map{|d| [d]})], :header => true, :row_colors => %w[cccccc ffffff]) do |t|
t.before_rendering_page do |page|
page.row(-1).border_bottom_width = 3
end
t.row(0).style :background_color => '000000', :text_color => 'ffffff'
t.cells.style :borders => []
end

Member

bradediger commented Sep 5, 2012

I believe your problem is that you have universally turned off borders with t.cells.style :borders => []. Your assignment to border_bottom_width has no effect because there are no borders on the cell you are setting the bottom border width of. I got your example to work by changing the third line to:

page.row(-1).style :borders => [:bottom], :border_bottom_width => 3

@bradediger bradediger closed this Sep 5, 2012

solisoft commented Sep 7, 2012

How to use master version in a Rails app ?

in Gemfile add:
gem 'prawn', git: 'git://github.com/prawnpdf/prawn.git'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment