skip to Main Content

I have deployed an app that uses wicked-pdf for PDF generation, but I can’t get it to work. My server uses ubuntu-20.04 and below is the error that I get (I use ruby:2.7.1-alpine)

/usr/local/bundle/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf:69:in `<main>': Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, CentOS 6/7/8, Debian 9/10, Archlinux amd64, or Intel-based Cocoa macOS (missing binary: /usr/local/bundle/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_alpine_3.12.0_amd64). (RuntimeError)

2

Answers


  1. Chosen as BEST ANSWER

    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'
    }
    

  2. I fixed it by running bundle update wkhtmltopdf-binary

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search