How to fix a table in a shrimp?

I created a table in a shrimp and wanted to pass the option :position , which is also documented in the manual, but it throws a Method_missing error. It looks like this parameter no longer exists. How can I center a table in a shrimp?

+6
source share
3 answers

I came across the same error. Installing from the wizard on Github fixed the problem.

 # Gemfile gem 'prawn', git: 'https://github.com/prawnpdf/prawn.git' 

Github issue

+5
source

Hope this helps

 pdf.table tablename, :border_width => 0, :font_size => 11, :position => :center 
+3
source

whether PDF generation is generated from the declared class or inside the controller you need to add the following line to your Gemfile

 gem 'prawn-table', '~> 0.2.1' 

At the time of writing, this is the gem version, this will give you access to table methods like position

I used it in this example and it worked

 def table_items(chart_data, doc) table = Prawn::Table.new(table_rows(chart_data), doc, {:header => true}) table.row(0).font_style = :bold table.position = :center table.draw end 
0
source

Source: https://habr.com/ru/post/910246/


All Articles