1
votes

Rails 4.1.1 Ruby 2.1.2

Gemfile : gem 'prawn', '~> 2.0.0'

I have PDF's working ok. I am now trying to add table in the pdf. But when i add table I get the following error...

undefined method `table' for XPDFClass

I tried adding...

require "prawn/table"

to the top of my file but then i get this error...

cannot load such file -- prawn/table

Any ideas where I might be going wrong?

2

2 Answers

1
votes

Make sure you have prawn-table in your Gemfile, in addition to the prawn gem. That should solve your problem.

0
votes

It was my own fault, I had table outside of a method. Working version...

def table_rows
  table([
    ["X", "Y"]
  ])
end

When it wasn't working I had it as just...

table([
  ["X", "Y"]
])