我在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