Skip to content
This repository was archived by the owner on Nov 29, 2019. It is now read-only.

Problem with test file after installation (NoMethodError) #17

Open
Katospiegel opened this issue Oct 2, 2014 · 8 comments
Open

Problem with test file after installation (NoMethodError) #17

Katospiegel opened this issue Oct 2, 2014 · 8 comments

Comments

@Katospiegel
Copy link

After Installation and trying to extract the referencies of a pdf appear the next problem:


/Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/font_metrics.rb:42:in `initialize': undefined method `ascent' for #<PDF::Reader::Font:0x007fd8cb1692d8> (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/model/characters.rb:134:in `new'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/model/characters.rb:134:in `block in build_fonts'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/model/characters.rb:131:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/model/characters.rb:131:in `build_fonts'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/model/characters.rb:163:in `block (2 levels) in include_in'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf.rb:81:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf.rb:81:in `block (2 levels) in expand_listeners_to_callback_methods'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf.rb:170:in `block in invoke_calls'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf.rb:169:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf.rb:169:in `invoke_calls'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf-extract.rb:42:in `block in parse'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf-extract.rb:38:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf-extract.rb:38:in `parse'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/lib/pdf-extract.rb:53:in `view'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/bin/pdf-extract:115:in `block (4 levels) in <top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/bin/pdf-extract:112:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/pdf-extract-0.1.1/bin/pdf-extract:112:in `block (3 levels) in <top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/import.rb:10:in `block in <top (required)>

@Katospiegel Katospiegel changed the title Problem with test file after installation Problem with test file after installation (NoMethodError) Oct 2, 2014
@kjw
Copy link
Contributor

kjw commented Oct 2, 2014

There's a number of other issues that discuss the lack of ascent in Font. Seems to be related to the version of pdf-reader used. I'm not sure what is the working combination of ruby version / pdf-extract version / pdf-reader version. Lost track a bit.

@iamgp
Copy link

iamgp commented Oct 7, 2014

Got this error too.

@iamgp
Copy link

iamgp commented Oct 7, 2014

#4 is closed but still not fixed.

@kjw
Copy link
Contributor

kjw commented Oct 16, 2014

Hi

Are you able to try an install from the github repo rather than Rubygems? I don't think the fix is packaged yet.

@osearbhain
Copy link

I had some success by downgrading pdf-reader to version 1.2 - I didn't need to go back as far as version 1.1.1, as recommended in #4. The "undefined method 'ascent' " message went away, and I didn't need to downgrade anything else (e.g. pdf-core, prawn).

gem uninstall pdf-reader
gem install pdf-reader -v 1.2

@jgrossi
Copy link
Contributor

jgrossi commented Jun 2, 2015

Check this out: #23

@AnikoG
Copy link

AnikoG commented Aug 20, 2015

These installation errors are caused by a faulty pdf-reader-1.3.3 gem version which you get from the repository.

Try this with ruby 2.0.0-p643 (I used it with RVM; on Ubuntu precise LTS)

You may need ttfunk-1.4.0
gem install ttfunk

Get the cloned pdf-reader-1.3.3 (and uninstall all other versions)
git clone https://github.com/yob/pdf-reader
cd pdf-reader
gem build pdf-reader.gemspec
gem install pdf-reader-1.3.3.gem # check version number

Then get the cloned pdf-extract (not the same as zip)
git clone https://github.com/CrossRef/pdfextract
cd pdfextract
gem build pdf-extract.gemspec
gem install pdf-extract-0.1.1.gem

I hope it helps... and many thanks for this tool

@jgrossi
Copy link
Contributor

jgrossi commented Aug 20, 2015

Yep @AnikoG! I had to compile the gem and everything worked ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants