2016-12-27 47 views
0

我在Windows的rails中使用wkhtmltopdf gem,但它不起作用。我得到這個錯誤: 「壞wkhtmltopdf的路徑:bundler:命令未找到:哪個」。 它適用於exe,但我不想使用exe_path,我只想使用寶石。 這是我wkhtmltopdf配置文件:不好wkhtmltopdf的路徑:bundler:命令未找到:其中

# WickedPDF Global Configuration 
# 
# Use this to set up shared configuration options for your entire application. 
# Any of the configuration options shown here can also be applied to single 
# models by passing arguments to the `render :pdf` call. 
# 
# To learn more, check out the README: 
# 
# https://github.com/mileszs/wicked_pdf/blob/master/README.md 

WickedPdf.config = { 
    # Path to the wkhtmltopdf executable: This usually isn't needed if using 
    # one of the wkhtmltopdf-binary family of gems. 
    # exe_path: 'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' 

} 

我還使用寶石「wicked_pdf」寶石「wkhtmltopdf二進制」

回答

0

它看起來像寶石wkhtmltopdf不支持Windows操作系統。我發現這個源代碼:

suffix = case RbConfig::CONFIG['host_os'] 
when /linux/ 
    (RbConfig::CONFIG['host_cpu'] == 'x86_64') ? 'linux_amd64' : 'linux_x86' 
when /darwin/ 
    'darwin_x86' 
else 
    raise "Invalid platform. Must be running on linux or intel-based Mac OS." 
end 

另一個提示是你收到這樣的事實:command not found: whichwhich是用於標識可執行文件位置的Unix命令,不適用於Windows。對不起

+0

得到它。謝謝@arpie! – ValeMarz

1

這個工作對我來說

exe_path: 'C://Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe'