Re: [pdf-reader] ruby on rails uninitialized constant PDF::READER error

399 views
Skip to first unread message

James Healy

unread,
Apr 5, 2013, 7:48:44 PM4/5/13
to pdf-r...@googlegroups.com
Hi Thilo,

The capitalisation of constants is important in Ruby. Try this:

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

James

On 6 April 2013 09:50, Thilo Es <t.sei...@googlemail.com> wrote:
> i got stuck trying to use the pdf-reader(V1.3.2) to dive in to a PDF unsing
> ruby on rails (ruby V1.9.3). I basicially get this as an error:
>
> Uninitialized constant PDF::READER
>
> I found some answers to the problem like:
> http://stackoverflow.com/questions/7384723/ruby-install-yob-pdf-reader
> but nothing really solved it.
> gem is installed and in the gemfile and in the bundle-command answer
>
> this is the library:
> https://github.com/yob/pdf-reader
>
> here is my code:
>
> class UploadController < ApplicationController
> require 'rubygems'
> require 'pdf/reader'
>
> def index
> render :file => 'app\views\upload\uploadfile.html.erb'
> reader = PDF::READER.new("hello.pdf")
> @pagenumbers = reader.page_count
> end
> def uploadFile
> @uploaded = false
> if post = Datafile.save(params[:upload])
> #render :text =>"File saved!"
> @uploaded = true
>
> index
> else render :text =>"file not saved!"
> end
> end
> def error_file
> render :text => "error"
> end
> end
>
> Any help very appreciated!
> THX!
>
> --
> You received this message because you are subscribed to the Google Groups
> "PDF::Reader" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pdf-reader+...@googlegroups.com.
> To post to this group, send email to pdf-r...@googlegroups.com.
> Visit this group at http://groups.google.com/group/pdf-reader?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Thilo Es

unread,
Apr 5, 2013, 8:08:00 PM4/5/13
to pdf-r...@googlegroups.com

Thanks! that solved it!
Reply all
Reply to author
Forward
0 new messages