PDFKit 不会在 Ubuntu on Rails 上渲染
我有
捆绑包 execrails -v
Rails 2.3.11
其中 wkhtmltopdf
/usr/bin/wkhtmltopdf
pdfkit (0.5.0)
该网站由 nginx +乘客 加载
一个简单的页面生成:
/!\ FAILSAFE /!\ Tue Jun 07 00:55:33 -0400 2011 Status: 500 Internal Server Error command failed: "/usr/bin/wkhtmltopdf" "--margin-right" "0.5in" "--page-size" "Letter" "--margin-top" "0.5in" "--margin-bottom" "0.5in" "--print-media-type" "--orientation" "Landscape" "--margin-left" "0.5in" "--quiet" "-" "-" /usr/lib/ruby/gems/1.8/gems/pdfkit-0.5.0/lib/pdfkit/pdfkit.rb:71:in `to_pdf' /usr/lib/ruby/gems/1.8/gems/pdfkit-0.5.0/lib/pdfkit/middleware.rb:19:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/string_coercion.rb:25:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/head.rb:9:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/methodoverride.rb:24:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/params_parser.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/session/abstract_store.rb:177:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:9:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:28:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/failsafe.rb:26:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'
这与我的开发服务器完美配合。非常感谢任何故障排除选项。
I have
bundle exec rails -v
Rails 2.3.11
which wkhtmltopdf
/usr/bin/wkhtmltopdf
pdfkit (0.5.0)
The site is served with nginx + passenger
Loading a simple page generates:
/!\ FAILSAFE /!\ Tue Jun 07 00:55:33 -0400 2011 Status: 500 Internal Server Error command failed: "/usr/bin/wkhtmltopdf" "--margin-right" "0.5in" "--page-size" "Letter" "--margin-top" "0.5in" "--margin-bottom" "0.5in" "--print-media-type" "--orientation" "Landscape" "--margin-left" "0.5in" "--quiet" "-" "-" /usr/lib/ruby/gems/1.8/gems/pdfkit-0.5.0/lib/pdfkit/pdfkit.rb:71:in `to_pdf' /usr/lib/ruby/gems/1.8/gems/pdfkit-0.5.0/lib/pdfkit/middleware.rb:19:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/string_coercion.rb:25:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/head.rb:9:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/methodoverride.rb:24:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/params_parser.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/session/abstract_store.rb:177:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:9:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:28:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/failsafe.rb:26:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'
This works perfectly with my development server. Any troubleshooting options greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这个问题与您在 PDFkit 初始化中的路径有关。
例如:
这是一个相对路径,在本地初始化就可以了。也许您应该更改路径才能正确使用 nginx。
I believe that this problem is with your path in the initialization of PDFkit.
For example:
This is a relative path, and the initialization, locally, is ok. Maybe you should change your path to work correctly with nginx.