生成pdf

cd rails_root
git clone git://github.com/sandal/prawn.git vendor/prawn

$ cd vendor/prawn/
$ git checkout origin/stable
$ git checkout -b stable

Now, prawn-core depends on some helper utilities, such as ttfunk and pdf-inspector (for running tests)


Note that when installing your Rails app on a staging or production server, you will need to init and update the submodule you just created in your project. That is, run these two commands from the root of your project to bring in Prawn. Then cd into vendor/prawn and run them again to bring in ttfunk and pdf-inspector.

config.load_paths << "#{RAILS_ROOT}/vendor/prawn/lib"

Then create a file called config/initializers/prawn.rb and in it, add one of the following lines, depending on your Prawn version:
Prawn through 0.8.4: require "prawn/core"
Prawn 0.9+ or git: require "prawn"
Now, Prawn should be ready to go. To test it, try this out:

$ ./script/console
Loading development environment (Rails 2.3.3)
>> Prawn::BASEDIR
=> "/home/myuser/devel/myproj/vendor/prawn"



sudo gem install pdf-reader
[sudo] password for simon:
Successfully installed Ascii85-1.0.1
Successfully installed pdf-reader-0.10.0
2 gems installed

sudo gem install ttfunk
[sudo] password for simon:
Successfully installed ttfunk-1.0.1
1 gem installed


script/plugin install git://github.com/thorny-sun/prawnto.git
Mime::Type.register_alias "application/pdf", :pdf
--------------------------------------------------------

prawn.gemspec
prawn dependency

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值