How to install wkhtmltopdf on a Linux based web server (shared hosting)

I tried in every way to get wkhtmltopdf installed on our web server, but unfortunately it is not installed. I cannot access the / bin user folder as indicated in the installation tutorial.

On the server in the public_html folder there is a _vti_bin subfolder, I copied the wkhtmltopdf-i386 file from wkhtmltopdf-0.9.1-static-i386 , but I canโ€™t execute it.

How to install wkhtmltopdf web server on (shared hosting) and make it work?

+59
pdf wkhtmltopdf
Feb 16 2018-10-16
source share
11 answers

I was able to successfully install wkhtmltopdf-amd64 on my shared hosting account without root access.

Here is what I did:

Download the corresponding static binary v0.10.0 from here: http://code.google.com/p/wkhtmltopdf/downloads/list

EDIT: Above moved here

through ssh on my shared host I typed the following:

$ wget {relavant url to binary from link above} $ tar -xvf {filename of above wget'd file} 

Then you will receive a binary file on your host and you can run it regardless of whether it is in the / usr / bin / folder or not. (or at least I could)

Test:

 $ ./wkhtmltopdf-amd64 http://www.example.com example.pdf 
  • Please note that if you are in the folder where the executable is located, you should probably prefix it with ./ to be sure.

Worked for me anyway

+50
Jun 25 '10 at 8:27
source share

Ubuntu 14.04 / 15.04 / 18.04:

 sudo apt-get install wkhtmltopdf # or sudo apt install wkhtmltopdf 

other

Look at the other answers.

+31
Jan 09 '15 at 20:59
source share

If his ubuntu then continues with this, already tested .: -

firstly, installing dependencies

 sudo aptitude install openssl build-essential xorg libssl-dev 

for 64-bit 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 

for 32-bit OS

 wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-i386.tar.bz2 tar xvjf wkhtmltopdf-0.9.9-static-i386.tar.bz2 mv wkhtmltopdf-i386 /usr/local/bin/wkhtmltopdf chmod +x /usr/local/bin/wkhtmltopdf 
+26
Apr 26 '11 at 8:28
source share

Most likely, without full access to this server (due to the fact that you are a registered account), you will have problems. I would go so far as to say that I think this is a futile effort - they need to block servers in hosted environments for a good reason.

Call your hosting company and ask them to install it, but do not expect a good answer - they usually will not install very custom items for single users unless there is a good reason (bug fixes for example).

Finally, depending on how familiar you are with server administration and what you pay for server hosting, consider something like http://www.slicehost.com . $ 20 per month you will get a low-level web server (256 sheep), and you can install anything you want. However, if you use multiple sites or have a heavy load, the cost will increase as you need larger servers.

GL!

+3
Feb 16 '10 at 16:08
source share

Debian 8 Jessie
It works sudo apt-get install wkhtmltopdf

+2
Mar 05 '16 at 8:32
source share

Put the wkhtmltopdf executable on the server and chmod it + x.

Create an executable shell script wrap.sh containing:

 #!/bin/sh export HOME="$PWD" export LD_LIBRARY_PATH="$PWD/lib/" exec $@ 2>/dev/null #exec $@ 2>&1 # debug mode 

Download the necessary shared objects for this architecture and place them in a folder named "lib":

  • Library /libfontconfig.so.1
  • Library /libfontconfig.so.1.3.0
  • Library /libfreetype.so.6
  • Library /libfreetype.so.6.3.18
  • lib / libX11.so.6 lib / libX11.so.6.2.0
  • lib / libXau.so.6 lib / libXau.so.6.0.0
  • lib / libxcb.so.1 lib / libxcb.so.1.0.0
  • Library / libxcb -xlib.so.0
  • Library / libxcb -xlib.so.0.0.0
  • Library /libXdmcp.so.6
  • Library /libXdmcp.so.6.0.0
  • lib / libXext.so.6 lib / libXext.so.6.4.0

(some of them are symbolic links)

... and you are ready to go:

 ./wrap.sh ./wkhtmltopdf-amd64 --page-size A4 --disable-internal-links --disable-external-links "http://www.example.site/" out.pdf 

If you encounter font problems such as squares for all characters, clearly identify TrueType fonts:

 @font-face { font-family:Trebuchet MS; font-style:normal; font-weight:normal; src:url("http://www.yourserver.tld/fonts/Trebuchet_MS.ttf"); format(TrueType); } 
+1
May 21 '10 at 13:58
source share

List of stable versions of wkhtmltopdf: http://wkhtmltopdf.org/downloads.html

Install wkhtmltopdf on Debian 8.2 (jessie) x64:

 sudo apt-get install xfonts-75dpi sudo apt-get install xfonts-base sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb sudo dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb 
+1
Dec 02 '15 at 23:39
source share

Several changes have changed since the top answers were added. They worked for me, but not quite so, so I hacked a bit and suggested the following solution for Ubuntu 16.04 . For Ubuntu 14.04, see the Comment at the bottom of the answer. Sorry if this does not work for shared hosting, but it looks like this is goto answer for the installation instructions for wkhtmltopdf in general.

 # Install dependencies apt-get install libfontconfig \ zlib1g \ libfreetype6 \ libxrender1 \ libxext6 \ libx11-6 # TEMPORARY FIX! SEE: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3001 apt-get install libssl1.0.0=1.0.2g-1ubuntu4.8 apt-get install libssl-dev=1.0.2g-1ubuntu4.8 # Download, extract and move binary in place curl -L -o wkhtmltopdf.tar.xz https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz tar -xf wkhtmltopdf.tar.xz mv wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf chmod +x /usr/local/bin/wkhtmltopdf 

Check this:

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

You should now have a file named google.pdf in the current working directory.

This approach downloads the binary from the site, which means that you can use the latest version instead of relying on the package managers to be updated.

Please note that for today, my solution includes a temporary fix to this error . I understand that the solution is really not very large, but I hope it can be removed soon. Be sure to check the status of the GitHub related issue to see if a fix is โ€‹โ€‹needed when you read this answer!

For Ubuntu 14.04, you will need to upgrade to a different version of libssl. You can find the versions here . In any case, be sure to consider the consequences of lowering libssl before doing this on any production server.

Hope this helps someone!

+1
Aug 07 '17 at 11:48 on
source share

After trying, below command works for me

 cd ~ yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 openssl git-core fontconfig wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz mv wkhtmltox/bin/wkhtmlto* /usr/bin 

respectfully

Jaiswar Vipin Kumar R.

+1
Mar 01 '18 at 10:31
source share

Shared hosting without access to ssh or shell?

This is how I did it;

  • Visit https://wkhtmltopdf.org/downloads.html and download the appropriate stable version for Linux. For my case, I chose 32-bit which is wkhtmltox-0.12.4_linux-generic-i386.tar.xz
  • Unzip the folder to the local drive.
  • Upload the folder to public_html (or depending on your location) using an FTP program, like any other file (s)
  • Modify the binary paths in the snappy.php file to indicate the appropriate files in the folder you just downloaded. Bingo! there you have it. You should be able to create PDF files.
0
Jul 25 '17 at 21:34
source share

In version 12.5 wkhtmltopdf, only DEB files are listed on their download page. Being a Mac user and not knowing a lot of linux or DEB files, I could not use the published solutions.

This page helped me overcome the well-known DEB file upload twist: http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/

Basically what I did was:

  1. Downloaded from https://wkhtmltopdf.org/downloads.html
  2. Unzipped the DEB file.
  3. Unpacked data.tar.xz file
  4. I uploaded the binary to the unpacked folder 'usr' from step 3 (usr / local / bin / wkhtmltopdf)

Then I found out that the "exec" function was disabled on my host. So make sure you can run exec if you use PHP to do this. "Can I run the wkhtmltopdf binary" is not specific enough. My fault.

0
May 01 '19 at
source share



All Articles