[kde-linux] Switching to KDE-4.2: Problem #1: I can't print to my printer

James Richard Tyrer tyrerj at acm.org
Fri Feb 13 11:07:48 UTC 2009


John Layt wrote:
> On Tuesday 10 February 2009 23:17:05 James Richard Tyrer wrote:
>> IAC, we seem to have wandered off of the issue. My printer prints 
>> fine form Okular-0.8 in KDE-4.2 -- the problem is not with the 
>> printer driver. The problem is that printing doesn't work with 
>> KWrite. I click "Print" and nothing happens -- I don't even see an 
>> error message. I hacked the code and it works fine. The problem is 
>> that I hacked the KATE code, could find no library to hack, and 
>> that probably means that other apps won't work either. I tried 
>> Konqueror and it wouldn't print a web page.
>> 
>> It has been suggested to me that this is a Qt bug. So, I updated 
>> Qt-COPY and am trying to build TRUNK against it.
> 
> 
> Apologies, I've been away and am just catching up. I haven't read the
>  bug report yet, but I can confirm that Qt does support printing 
> through lpr, it falls back to lp support if CUPS is not installed.
> 
At least the documentation says that. :-)
> 
> You say you can print through Okular, which suggests to me your 
> printer appears in the Qt print dialog?

Actually, it lists "lp".

> Same as it does in Kwrite and the other apps?

Yes that is correct.

> So it seems Qt is talking to lp ok to find out the installed
> printers. 

Is it perhaps failing to parse the "printcap" file correctly?

> So that suggests that there is a bug with Qt actually
> subbing the print file to lpr. So this should be reported to Qt.
> Don't be too surprised if the issue isn't fixed in Qt 4.5, lpr
> support probably doesn't get as extensive testing now virtually every
> disto and *nix varient ships with CUPS.
> 
I find that an unfortunate trend.  A much simpler Spooler that always 
used GhostScript for the RIP would be better.  IAC, I have apps that 
will not use CUPS and I prefer to use the GhostScript RIP devices.  I 
still do not understand why CUPS doesn't use the GhostScript "printer 
drivers" now that they are no longer trying to sell their proprietary 
drivers.  FooMatic is a hack, but it does work -- the only problem is 
the PPD copyright issue.  Unfortunately, when CUPS started using 
modified PPD file too they also have the same problem.
> 
> The reason Okular works when the others don't is that in order to 
> print high quality PDF files we use the Qt print dialog but bypass 
> using Qt to sub the print file to lpr/CUPS and do it ourselves. We 
> can't do this for all of KDE as it is not cross-platform, with Qt we 
> get Win and Mac support for free.
> 
Probably drifting off topic:

What I did was not a patch but rather a debugging hack.

------8<------8<------8<------8<------8<------8<------8<------8<------

Index: utils/kateprinter.cpp
===================================================================
--- utils/kateprinter.cpp       (revision 925161)
+++ utils/kateprinter.cpp       (working copy)
@@ -62,6 +62,8 @@ bool KatePrinter::print (KateDocument *d

    QPrinter printer;

+  printer.setPrintProgram ("lpr");
+
    // docname is now always there, including the right Untitled name
    printer.setDocName(doc->documentName());

------8<------8<------8<------8<------8<------8<------8<------8<------

resulted in printing from KWrite working.

Although I wonder how it would work with more than one printer.

IIUC from reading the Qt documentation, this would have no effect with
WIN or MAC (setPrintProgram):

> On X11, this function sets the program to call with the PostScript 
> output. On other platforms, it has no effect.

And yes, this appears to be a Qt bug.  However, it could also be
considered to be a KDE bug since Okular sets "lpr" somewhere and,
therefore, works.  The documentation suggests (setPaperSize):

> This function is useful mostly for setting a default value that the 
> user can override in the print dialog.

so it appears to me that KDELibs could do this and we wouldn't have to 
wait for Trolltech.  This could also resolve other issues.  My 
perspective as a user is that printing in KDE-4.2 is seriously broken. 
We are shipping a broken product and shouldn't wait for TrollTech to fix 
the problem.

-- 
JRT



More information about the kde-linux mailing list