Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shoaibjdev/27302325fef3fe86618f557ee8e9bcb3 to your computer and use it in GitHub Desktop.
Save shoaibjdev/27302325fef3fe86618f557ee8e9bcb3 to your computer and use it in GitHub Desktop.
How to install `wkhtmltopdf` & `wkhtmltoimage` on Centos

Install wkhtmltopdf & wkhtmltoimage

wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine.

  1. Get the latest version of the RPM directly from the homepage.
    wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm
  2. Install RPM.
    sudo yum install wkhtmltox-0.12.5-1.centos7.x86_64.rpm
  3. Confirm installation location.
    rpm -ql wkhtmltox
  4. Add the installation path to the PATH.
    cat >> ~/.bashrc <<- "EOM"
    export PATH=$PATH:{pathToBinaries}
    EOM
  5. Test w/ a local html file.
    cat test.html | wkhtmltopdf - test.pdf
@mm326
Copy link

mm326 commented Mar 18, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment