wkhtmltopdf不能运行在ununtu24.04上



https://github.com/zakird/wkhtmltopdf_binary_gem/issues/62

The problem is that it takes your system version (19.04) To find the binary of that version, currently there is only until version 18.04, you can verify it in the following route:

~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/wkhtmltopdf-binary-0.12.5.4/bin/

My solution was to make it take the binary for version 18.04, you need to modify the following line of the following file:

/home/jorge/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf 

this line you need to change or comment:
 binary = "#{__FILE__}_#{suffix}"

for this:
 binary = "#{__FILE__}_ubuntu_18.04_amd64"


Fixed it by adding the following line to dockerfile:

RUN apk --no-cache add wkhtmltopdf ttf-ubuntu-font-family

And updating config/initializers/wicked_pdf.rb

require "wicked_pdf"

WickedPdf.config = {
  exe_path: '/usr/bin/wkhtmltopdf'
}

阅读量: 441
发布于:
修改于: