khtml2png logo

Support this FFII project in its fight against software patents
> About


> Download

> Links

> Help wanted

> Support / Contact

Rote Karte für Internetschnüffler!



Sponsored by logo

Frequently asked questions

Why can't I run khtml2png without an X session?

khtml2png uses the khtml library as it is used in the KDE webbrowser Konqueror. The library needs an X session to display the rendered webpage. There is no way (without hacking the whole khtml library) to redirect the rendered webpage to a file.

How do I run khtml2png without a visible X session?

For running khtml2png you need an accessible X session. It is not important that you can see the X session on a monitor etc. but it must be accessible. If you want to run khtml2png on a webserver you will have a graphiccard only seldomly. You can use the virtual X server Xvfb as a replacement for a "real" X server that displays the output on a real graphiccard with attached monitor. There is no visible output but the whole computation of image that would be shown on a monitor is done as required by khtml2png. You can use khtml2png with Xvfb like this:
# Start the virtual X server with a resolution of 1600x1200 with 32 bit color depth
# (maybe you need to increase the value ":1")
Xvfb :1 -screen 0 1600x1200x32&
#give the virtual X server some time to start up
sleep 3
export DISPLAY=localhost:1.0
khtml2png2 <parameters>

Why is scrolling needed when making big screenshots?

The khtml library used by khtml2png is optimised for displaying webpages on a screen. It avoids to display hidden objects (like buttons) that are outside the browser window. As a result these objects are shown as a gray box only and would be shown in the screenshot as gray box too.

I get gray bars my screenshots

These gray bars are caused by dialogs shown for accepting cookies and blockig popups. To avoid these dialogs you can edit the configuration files or configure the settings via Konqueror. If you choose the direct file editing method do as follows as the user you will run khtml2png under. Edit ~/.kde/share/config/kcookiejarrc and add the lines:
[Cookie Dialog]

[Cookie Policy]
Now add in ~/.kde/share/config/khtmlrc the following lines:
[Java/JavaScript Settings]

How can I build my own Debian package?

Fetch the latest source tar file and extract it. Change to the new khtml2png directory and run:
If you want to change the architecture form i386 to the architecture of your current system (e.g. amd64) edit the line "Architecture" when opens the editor and change "i386" to "amd64" (or whatever your are compiling on). After closing the editor the package is built and you should find a new Debian package in the current directory.

How to comile khtml2png with debug informationen?

gcc -O0 -g -ggdb -lqt-mt -lkdecore -lkhtml -I /usr/include/qt3/ -I /usr/include/kde/ khtml2png.cpp -o /tmp/khtml2png