Hermann Ingjaldsson Hermann Ingjaldsson - 11 days ago 4x
Ruby Question

ruby install yob pdf reader

I'm trying to install the yob pdf reader: https://github.com/yob/pdf-reader#readme

I'm following the directions there and do:

gem install pdf-reader

and that reports success.

I place a pdf in my directory, name it

Then I create a script that has the following code:

reader = PDF::Reader.new("1.pdf")

when I run that script I get the following error:

uninitialized constant PDF (NameError)

Googling it hasn't been very successful so far.

How do I solve this?


If it's a pure ruby script, you may be missing the following at the beginning:

require 'rubygems'
require 'pdf-reader'

You can also specify the version of the gem that you want to require, in case you have multiple versions installed:

require 'rubygems'
gem 'pdf-reader', "~> 0.10.0"
require 'pdf-reader'