Skip to content

Instantly share code, notes, and snippets.

@brunogaspar
Last active October 7, 2022 09:08
Show Gist options
  • Star 85 You must be signed in to star a gist
  • Fork 30 You must be signed in to fork a gist
  • Save brunogaspar/bd89079245923c04be6b0f92af431c10 to your computer and use it in GitHub Desktop.
Save brunogaspar/bd89079245923c04be6b0f92af431c10 to your computer and use it in GitHub Desktop.
Install wkhtmltopdf on Ubuntu (14.04 64-bit) or (16.04 64-bit)

Install wkhtmltopdf on Ubuntu

This was tested on:

  • Ubuntu 14.04 x64
  • Ubuntu 16.04 x64

Installation

sudo apt-get update
sudo apt-get install xvfb libfontconfig wkhtmltopdf

Test

Now it's time to test that everything is working as expected

wkhtmltopdf http://www.google.com google.pdf

If you see Done, then everything is installed correctly and you're ready to generate some PDF's :D

@StevenMapes
Copy link

Check the dependencies before and after each version is installed its likely that there is an underlying lib that's changed if it's not this package

@anshu7k
Copy link

anshu7k commented Aug 7, 2020

thanks bruno for the suggestion but i wrote on stackoverflow but didnot recieved any response there.

thanks for the advice steven, Let me chck the dependecies agian.. I will get back to u

@FrancisGauthier
Copy link

Solution for QXcbConnection: Could not connect to display:
alias wkhtmltopdf='xvfb-run wkhtmltopdf'

Worked for my docker image. Thank you

@EvgeniySu
Copy link

Instead of all from above, use this sample. It is just another wrapper over this library containing support for 3 platforms. Do not forget to copy Rotativa to your project.
https://github.com/fpanaccia/Wkhtmltopdf.NetCore.Example

@Garrett-R
Copy link

Garrett-R commented Oct 8, 2020

To get the latest wkhtmltopdf version (0.12.6 as of now):

sudo apt update
sudo apt install wget xfonts-75dpi
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb

(the URL is found here)

@aipladmin
Copy link

apt-get command not found is getting what should I do Now

@brunogaspar
Copy link
Author

apt-get command not found

Without giving us any information about your setup like what distro you're on, is quite impossible to know. But try using yum instead of apt for example.

what should I do Now

You should use Google and search for your problem, takes just a second..

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