Rails: Error running wkhtmltopdf — (error while loading shared libraries)

前端 未结 11 1576
一向
一向 2021-02-04 23:12

When my app runs (or when I run from commandline) the wkhtmltopdf command I get the following error: (showing it from command line)

#> wkhtmltopdf 
wkhtmltopd         


        
11条回答
  •  逝去的感伤
    2021-02-04 23:59

    I had this same issue on running a Rails 5.2 application on an Ubuntu 18.04 production server, the issue was that there were missing dependencies for libXrender on the server

    Here's how I solved it:

    Run the command below to search for the missing dependencies:

    sudo apt-cache search libXrender
    

    This will display the output below:

    libxrender-dev - X Rendering Extension client library (development files)
    libxrender1 - X Rendering Extension client library
    libreoffice - office productivity suite (metapackage)
    

    If you're running on a production server, simply install libxrender1 only (for rendering PDFs):

    sudo apt-get install libxrender1
    

    Also, if possible run upgrades for outdated libraries on your server:

    sudo apt upgrade
    

    Once, all these have been completed, simply restart your application server (If your application server is puma and if your setup systemd for the server):

    sudo systemctl restart puma
    

    That's all.

    I hope this helps

提交回复
热议问题