Why does PDFKit/wkhtmltopdf hang but renders PDF as expected when Rails app is killed?

后端 未结 7 1489
無奈伤痛
無奈伤痛 2020-12-04 12:18

Background

After reading around it seemed to me that Prawn is out and wkhtmltopdf is in. It also seems like the PDFKit and wicked_pdf gems for Rails are the new co

7条回答
  •  盖世英雄少女心
    2020-12-04 13:06

    Try editing config/initializer/pdfkit.rb in the following way:

    PDFKit.configure do |config|
    
    config.wkhtmltopdf = Rails.root.join('bin', 'wkhtmltopdf-i386').to_s
    
    config.default_options = {
    
      :encoding=>"UTF-8",
      :page_size=>"A4",
      :margin_top=>"0.25in",
      :margin_right=>"0.1in",
      :margin_bottom=>"0.25in",
      :margin_left=>"0.1in",
      :disable_smart_shrinking=> false
    }
    end
    

提交回复
热议问题