Monday, May 25, 2009

How to make KPrinter work with Firefox 3?

openSUSE 11.1

In the recent past there have been several new software updates and upgrades which have almost infuriated me and forced me to revert to using old versions. The top two of these new things are:
  1. Firefox 3 which cannot be persuaded to use kprinter anymore the way Firefox 2 was persuaded.

  2. KDE 4 and its applications which totally and absolutely ignore the KDE 3 configuration with no apparent way to migrate the configuration either. Fortunately openSUSE still carries KDE 3.5 which I'm using currently.

The first of these items, however, is solved now, and here are the steps I took to make kprinter work with Firefox 3 (inspired by a post from this thread):
  1. The first step is to edit the file /etc/gtk-2.0/gtkrc and add the following line to the end:
    gtk-print-backends = "lpr,file"

    This will make the lpr target appear in the Firefox 3 print dialog.

  2. The second step is to switch the lpr command for kprinter command by executing:
    cd ~/bin
    ln -s `which kprinter` lpr

  3. And the third and final step is to get rid of the Firefox 3 print dialog by opening the URL about:config and creating there the following new Boolean option:
    print.always_print_silent = true

And that's it - Firefox 3 now prints directly to kprinter.

NB! The only quirk I've found is that you cannot cancel the kprinter dialog - or it will hang Firefox 3 for some reason.

EDIT: After some testing, however, this way of printing seems to be very buggy - most pictures do not print at all and those that do end up on the printed page are heavily compressed with visible compression artifacts, the text is uneven and looks ugly.
It seems that the LPR printing uses the lowest possible resolution with no known way to fix this higher.

I've switched back to Firefox 2.0.0.20 for now until the Firefox 3 will play nice within KDE!

No comments: