红宝石安装yob pdf阅读器 [英] ruby install yob pdf reader
本文介绍了红宝石安装yob pdf阅读器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试安装yob pdf阅读器: https://github.com/yob /pdf-reader#readme
I'm trying to install the yob pdf reader: https://github.com/yob/pdf-reader#readme
我正在按照指示去做:
gem install pdf-reader
报告成功.
我在目录中放置了一个pdf文件,并将其命名为1.pdf
.
I place a pdf in my directory, name it 1.pdf
.
然后,我创建一个包含以下代码的脚本:
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.
我该如何解决?
推荐答案
如果它是纯红宝石脚本,则一开始可能会缺少以下内容:
If it's a pure ruby script, you may be missing the following at the beginning:
require 'rubygems'
require 'pdf-reader'
如果安装了多个版本,还可以指定所需的gem版本:
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'
这篇关于红宝石安装yob pdf阅读器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文