I am trying to generate pdf in production server.In local host everything works fine for me. No error while I am generating PDF. but in production getting this error.
2.3.1 :001 > WickedPdf.new.pdf_from_string("<p>hello</p>")
RuntimeError: Failed to execute:
["/home/ubuntu/.rvm/gems/ruby-2.3.1/bin/wkhtmltopdf", "file:////tmp/wicked_pdf20211210-26525-1jrpwxd.html", "/tmp/wicked_pdf_generated_file20211210-26525-1nj8sms.pdf"]
Error: PDF could not be generated!
Command Error: /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/wkhtmltopdf-binary-0.12.6.5/bin/wkhtmltopdf:61:in `<top (required)>': Invalid platform, must be running on Ubuntu 16.04/18.04/20.04 CentOS 6/7/8, Debian 9/10, archlinux amd64, or intel-based Cocoa macOS (missing binary: /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/wkhtmltopdf-binary-0.12.6.5/bin/wkhtmltopdf_ubuntu_14.04_amd64). (RuntimeError)
from /home/ubuntu/.rvm/gems/ruby-2.3.1/bin/wkhtmltopdf:25:in `load'
Gemfile that I have used
gem 'wicked_pdf', '~> 2.1'
gem 'wkhtmltopdf-binary', '~> 0.12.6.5'
gem 'wkhtmltopdf-binary-edge', '~> 0.12.6.0'
config/initializers/wicked_pdf.rb file
if Rails.env.production?
wkhtmltopdf_path = "/home/ubuntu/.rvm/gems/ruby-2.3.1/bin/wkhtmltopdf"
else
# Linux (check your processor for Intel x86 or AMD x64)
# wkhtmltopdf_path = "#{Rails.root}/bin/wkhtmltopdf-amd64"
# wkhtmltopdf_path = "#{Rails.root}/bin/wkhtmltopdf-i386"
# OS X
wkhtmltopdf_path = "#{Rails.root}/bin/wkhtmltopdf-0.9.9-OS-X.i386"
# Windows
# wkhtmltopdf_path = 'C:\Program Files/wkhtmltopdf/wkhtmltopdf.exe'
end
WickedPdf.config = { exe_path: wkhtmltopdf_path, wkhtmltopdf: wkhtmltopdf_path }
Using ruby version 2.3.1 Rails 4.2.7.1 Bundler version 2.2.30