Upgrading wkhtmltoimage


#1

Hi, I currently have wkhtmltoimage 0.12.4 installed in:

/home/[user]/wkhtmltox/bin/wkhtmltoimage

I am trying to upgrade to the latest version 0.12.5: https://wkhtmltopdf.org/downloads.html

I am using SSH in Terminal on a mac. Any tips on the best way to achieve this?

Thanks


#2

You can use wget to download the pre-built package and then extract it with dpkg. For example:

wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
dpkg --extract wkhtmltox_0.12.5-1.bionic_amd64.deb myroot

The above puts all the files in the directory myroot. For example, the image binary would be at: myroot/usr/local/bin/wkhtmktoimage

To get your original setup, replace the contents of /home/[user]/wkhtmltox/ with myroot/usr/local/


#3

Thanks a lot. wget and dpkg seemed to run well, but when I run

myroot/usr/local/wkhtmltox/bin/wkhtmltoimage --version

I get

-bash: myroot/usr/local/wkhtmltox/bin/wkhtmltoimage: No such file or directory

However when I run

/home/[myusername]/wkhtmltox/bin/wkhtmltoimage --version

I still get 0.12.4. Have I missed something?


#4

The myroot path won’t have wkhtmltox in it. Try:

 myroot/usr/local/bin/wkhtmltoimage --version

#5

Thanks, that’s helped. If I run this in Terminal

/usr/local/bin/wkhtmltoimage --version

I get

wkhtmltoimage 0.12.5

However, when I run it from a subdirectory (inside a php script) it doesn’t find it:

exec("ls /usr/local/bin &> '_output.txt' ");

Doesn’t list wkhtmltoimage. Do I need to call a few parent directories ?


#6

Yes, for a locally installed program, you’ll need to provide a full path to the binary or modify the PATH environment variable. If you extracted the package into myroot in your home directory, then the full path would be: /home/[username]/myroot/usr/local/bin/wkhtmlimage

Note that there is nothing special about the directory name “myroot” – you can call it anything you want.


#7
/home/[username]/myroot/usr/local/bin/wkhtmlimage --version

Produces ‘No such file or directory’

Maybe I’m getting confused with what ‘myroot’ is - However

/home/[username]/wkhtmltox/bin/wkhtmltoimage --version

Still produces ‘wkhtmltoimage 0.12.4’

is there any way at all I can upgrade whats in /home/[username]/wkhtmltox/bin/wkhtmltoimage ?

Thanks!


#8

I tried also

dpkg --extract wkhtmltox_0.12.5-1.bionic_amd64.deb /home/[username]/wkhtmltox/

#9

In this case, the full path of the binary would be:

/home/[username]/wkhtmltox/usr/local/bin/wkhtmltoimage

#10

Yes, replace the contents of wkhtmltox with the contents of usr/local from the package. Here’s what you might do:

: ... download and extract to /home/[username]/myroot as described above...

: Rename old version to keep it out of the way
mv /home/[username]/wkhtmltox /home/[username]/OLD-wkhtmltox

: Move new version into place
mv /home/[username]/myroot/usr/local /home/[username]/wkhtmltox

#11

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.