There are some issues encounters while installing khtml2png using manuals from internet. Below, I try to describe some points to avoid the problems while installing khtml2png.
1. Installing all dependencies we need (for RedHat based systems such as CentOS):
# yum install gcc gcc-c++ automake autoconf zlib zlib-devel # yum groupinstall "X Window System" "KDE (K Desktop Environment)" # yum install kdelibs kdelibs-devel # yum install Xvfb xorg xorg-x11-font*
2. Installing khtml2png from .tar.gz distribution package:
# wget http://path_to_tar_gz/khtml2png-2.7.6.tar.gz # tar xzf khtml2png-2.7.6.tar.gz # cd khtml2png-2.7.6
3. We need to edit the configure file to be look like this:
./makeClean cmake -D QT_INCLUDE_DIR:PATH=/usr/lib64/qt-3.3/include/ -D QT_QT_LIBRARY:PATH=/usr/lib64/qt-3.3/lib/libqt.so -D QT_MOC_EXECUTABLE:FILEPATH=/usr/lib64/qt-3.3/bin/moc . -G KDevelop3 cmake -D QT_INCLUDE_DIR:PATH=/usr/lib64/qt-3.3/include/ -D QT_QT_LIBRARY:PATH=/usr/lib64/qt-3.3/lib/libqt.so -D QT_MOC_EXECUTABLE:FILEPATH=/usr/lib64/qt-3.3/bin/moc .
You should check paths to QT library, if you haven’t libqt.so file, the solution is to use libqt-mt.so file – simply make a symbolic link to it:
# cd /usr/lib64/qt-3.3/lib # ln -s ./libqt-mt.so libqt.so
/usr/lib64/ – I have the x86_64 architecture.
4. Now we can try to configure and make the app:
# ./configure # make # make install
5. Run the Xvfb in background:
# Xvfb :2 -screen 0 1024x768x24&
6. And we can make our first screenshot:
# DISPLAY=localhost:2.0 khtml2png2 http://google.com google.png

Hey man, great tutorial! I got stuck at some point… when I try give the make command this is what it returns:
Scanning dependencies of target khtml2png2
[100%] Building CXX object CMakeFiles/khtml2png2.dir/khtml2png.o
make[2]: *** No rule to make target `/usr/lib64/qt-3.3/lib/libqt.so’, needed by `khtml2png2′. Stop.
make[1]: *** [CMakeFiles/khtml2png2.dir/all] Error 2
make: *** [all] Error 2
Can you help? Thanks