khtml2png is a command line program to create PNG images out of webpages. Despite the name, it can also produce JPEG images.
Step one : install Requirements.
#yum install gcc gcc-c++ automake autoconf nano zlib zlib-devel kdelibs kdelibs-devel //kde,gcc
#yum groupinstall “X Window System” “KDE (K Desktop Environment)” //xwindows
#yum install Xvfb xorg “xorg-x11-font*” //Xvfb,xorg
#yum install qt* //qt
Step two: install cmake
#wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
#tar -zxvf cmake-2.6.2.tar.gz
#cd cmake-2.6.2
#./bootstrap
#make
#make install
Step three: install khtml2png
#wget http://nchc.dl.sourceforge.net/sourceforge/khtml2png/khtml2png-2.7.6.tar.gz
#tar zxvf khtml2png-2.7.6.tar.gz
#cd khtml2png-2.7.6
# vi configure
//change QT path like below:
cmake -G KDevelop3 -D QT_INCLUDE_DIR:PATH=/usr/lib/qt-3.3/include .
cmake -D QT_INCLUDE_DIR:PATH=/usr/lib/qt-3.3/include .
//save and quit
#./configure
#make
#make install
Step four: first time run
#Xvfb :2 -screen 0 1024x768x24&
#export DISPLAY=localhost:2.0
//edit ~/.kde/share/config/kcookiejarrc , add below lines:
[Cookie Dialog]
PreferredPolicy=2
ShowCookieDetails=false[Cookie Policy]
CookieDomainAdvice=
CookieGlobalAdvice=Accept
//save and quit
//edit ~/.kde/share/config/khtmlrc , add below lines
[Java/JavaScript Settings]
PopupBlockerPassivePopup=false
//save and quit
/////test run :
#khtml2png2 –get-body -w 1024 -h 800 http://www.google.com/ google.png
Tags: khtml2png, website screenshot