wicked_pdf does not run on Ubuntu server : wkhtmltopdf: cannot connect to X server

后端 未结 3 861
渐次进展
渐次进展 2021-02-01 08:05

I\'m trying to use wicked_pdf on my prod server but it keeps failling :

RuntimeError (Failed to execute:
\"/usr/bin/wkhtmltopdf\" -q        \"file:////tmp/wicked         


        
3条回答
  •  春和景丽
    2021-02-01 08:42

    This post helped me to resolve my problem : http://www.stormconsultancy.co.uk/blog/development/generating-pdfs-in-rails-with-pdfkit-and-deploying-to-a-server/

    I'm reproducing here the step from this post that helped me to install it :

    # first, installing dependencies
    sudo aptitude install openssl build-essential xorg libssl-dev
    
    # for 64bits OS
    wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
    tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
    mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
    chmod +x /usr/local/bin/wkhtmltopdf
    

    He also create an initializer to tell to pdfKit where it is, so this method is for wicked PDF and PDF Kit.

提交回复
热议问题