我在rails應用程序中使用wicked_pdf gem,一切正常。問題是我已經安裝了wicked_pdf.exe,因爲wicked_pdf gem無法正常工作。 它返回此錯誤:wicked_pdf(或類似)的wkhtmltopdf的路徑不正確。 這是我wicked_pdf配置:如何在rails中使用wicked_pdf gem?
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',
# or
#exe_path: Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf')
# Layout file to be used for all PDFs
# (but can be overridden in `render :pdf` calls)
# layout: 'pdf.html',
}
我如何使用正確的方法寶石?我需要發送我的應用程序到另一臺電腦,我不想在每臺電腦上安裝該exe文件。 我不想使用exe,我只想使用寶石。
Hi @ whodini9!謝謝,但它仍然無法正常工作。我已經安裝了gem'wicked_pdf',gem'wkhtmltopdf-binary'和「exe_path:'C:\ RailsInstaller \ Ruby2.2.0 \ bin \ wkhtmltopdf'」而不是「exe_path:'C:\ Program Files \ wkhtmltopdf \ bin \ wkhtmltopdf.exe'」。這是運行時錯誤:wkhtmltopdf不可執行 – ValeMarz
您可以嘗試使用第二個選項:exe_path:Gem.bin_path('wkhtmltopdf-binary','wkhtmltopdf')。另外通常更安全的使用File.join(「C:\」,「Program Files」,「#{foo}」,bar) – whodini9
仍然「wkhtmltopdf不可執行」 – ValeMarz