2013-03-12 37 views
1

在我的項目中,我在Windows平臺上使用過PDFKIT。最初它工作正常,但現在它給出了一些奇怪的錯誤信息。ROR + PdfKit +沒有這樣的文件或目錄 - 「C:\ Program Files \ wkhtmltopdf \ wkhtmltopdf.exe」

沒有這樣的文件或目錄 - 「C:\程序\ 文件\ wkhtmltopdf \ wkhtmltopdf.exe」 「--page大小」, 「信」 「--margin頂」, 「0.75英寸」「 - 右邊「」0.75in「」 - 邊緣 - 底部「 」0.75in「」 - margin-left「」0.75in「」--encoding「」UTF-8「」--quiet「」 - 「 」 - 「

我沒有辦法解決它,這裏是ruby代碼。

kit = PDFKit.new(html) 
send_data(kit.to_pdf, :filename => "#{file_name}.pdf", :type =>'application/pdf') 

文件:應用程序/配置/初始化/ pdfkit.rb

PDFKit.configure do |config| 
    config.wkhtmltopdf = 'C:\Program Files\wkhtmltopdf\wkhtmltopdf.exe' 
    # config.default_options = { 
    # :page_size => 'Legal', 
    # :print_media_type => true 
    # } 
    # config.root_url = "http://localhost" # Use only if your external hostname is unavailable on the server. 
end 

在此先感謝..

回答

1

發生這種情況時我的系統上我通過移動wkhtmltopdf到一個目錄,它解決它路徑不包括空間。

相關問題