Producing a screendump of a website on a Linux server

I'm in a situation where I need to produce a screenshot of a website as part of an automated process on a web server. While this is not a big deal on a desktop, making a screendump on a machine that has, in fact, no screen at all proves a bit more challenging. The solution should obviously be command line based. I also do not want rely on any third party website (of which there are a ton out there) to produce the screenshots. The preferred form of output would be an image of any of the common formats (jpg, png, gif).
1 answer

Using wkhtmltoimage to produce screenshots of a website

wkhtmltoimage is a tool that I found to be quite useful when producing screendumps of websites. The homepage may be found here. I'm using it on several servers and have not had any difficulties yet.

With newer versions there are almost no system prerequisites. Depending on the distribution you may have to install one or two X11 libraries to get the fonts right. For example some users reported that they had to install urw-fonts or libx11-dev. Otherwise the static binary runs out of the box, tested on Ubuntu, RHEL and Arch Linux.

Usage in the simplest case amounts to just "wkhtmltoimage [input file] [output file]" where the input file can either be a web address or a local html file. Additionally the application comes with a lot of optional parameters which include e.g. disabling JavaScript, using custom style sheets or even modifying cookies.

There is also a version that produces PDF instead of images called wkhtmltopdf. It can be found on the same website.