0

私は持っている

バンドル実行レール -v

レール 2.3.11

どの wkhtmltopdf

/usr/bin/wkhtmltopdf

pdfkit (0.5.0)

サイトはnginx +パッセンジャーで提供されています

単純なページをロードすると、次が生成されます。

/!\ フェールセーフ /!\ 2011 年 6 月 7 日火曜日 00:55:33 -0400
  ステータス: 500 内部サーバー エラー
  コマンドが失敗しました: "/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 `キャッシュ'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:9:「キャッシュ」内
    /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'

これは私の開発サーバーで完全に機能します。トラブルシューティングのオプションは大歓迎です。

4

1 に答える 1

1

この問題は、PDFkitの初期化におけるパスにあると思います。例えば:

html_file = File.new('html/your-file.html')
kit = PDFKit.new(html_file, :page_size => 'Letter', :header_html => "**html/template/header.html**", :footer_html => "**html/template/footer.html**")

これは相対パスであり、ローカルでの初期化は問題ありません。nginx で正しく動作するようにパスを変更する必要があるかもしれません。

于 2012-03-09T17:31:32.967 に答える