Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails PDF工具包+;生产服务器上的wkhtmltopdf二进制PDF收缩问题_Ruby On Rails_Ruby_Pdfkit_Wkhtmltopdf Binary - Fatal编程技术网

Ruby on rails PDF工具包+;生产服务器上的wkhtmltopdf二进制PDF收缩问题

Ruby on rails PDF工具包+;生产服务器上的wkhtmltopdf二进制PDF收缩问题,ruby-on-rails,ruby,pdfkit,wkhtmltopdf-binary,Ruby On Rails,Ruby,Pdfkit,Wkhtmltopdf Binary,我正在使用gem'pdfkit'和gem'wkhtmltopfdbinary'在RubyonRails应用程序上生成发票。我有一个erb文件,我按如下方式渲染它: kit = PDFKit.new(ActionController::Base.new.render_to_string('billing/invoice_pdf', layout: nil, locals: { invoice: invoice_data }), pdf_option) file = kit.to_f

我正在使用
gem'pdfkit'
gem'wkhtmltopfdbinary'
在RubyonRails应用程序上生成发票。我有一个erb文件,我按如下方式渲染它:

    kit = PDFKit.new(ActionController::Base.new.render_to_string('billing/invoice_pdf', layout: nil, locals: { invoice: invoice_data }), pdf_option)
    file = kit.to_file("#{Rails.root}/tmp/#{@invoice.id}_#{@invoice.remote_id}.pdf")
    @invoice.document = Document.create(file: file)
pdf\u选项


  def pdf_option
    {
      disable_smart_shrinking: false,
      page_size:               'A4',
      margin_top:              '0',
      margin_right:            '0',
      margin_bottom:           '0',
      margin_left:             '0',
      encoding:                'UTF-8'
    }
  end
生成的pdf在本地计算机上看起来不错,但在生产服务器上却变得很奇怪

这是本地机器pdf

这是生产的


有什么想法吗?怎么了?谢谢

当您运行本地生产时,它看起来如何?@anothermh它看起来就像第一张图片中的一样,关于Linux和dpi有一些问题,如下所示。你必须检查你的产品/本地操作系统的差异,wkhtmltopdf版本等。我猜你是在Mac上工作?在本地工作时,我不得不应用不同的缩放,即使在那时,它仍然不同于在Linux上工作。当您运行本地生产时,它看起来如何?@anothermh它看起来像在第一张图片中一样,Linux和dpi存在一些问题,如下所示。你必须检查你的产品/本地操作系统的差异,wkhtmltopdf版本等。我猜你是在Mac上工作?在本地工作时,我必须应用不同的缩放,即使如此,它仍然不同于在Linux上工作。