Bug in KDEPrint/CUPS

Goffioul Michael goffioul at imec.be
Mon Mar 29 16:32:35 BST 2004


What's missing here is a call to KPrinter::preparePrinting(). This
call is needed to perform some internal synchronization and option
processing. This is automatically triggered by QPainter::begin(), which
is not your case because you do not create any QPainter on KPrinter
object. The problem here is that KPrinter::preparePrinting() is
protected so you don't have access to it. It is planned to make it
public in KDE-4.
In the meantime, the easiest for you is to subclass KPrinter to have
access to that protected method, and call it just after the setup()
call. Then, you'll get correct orientation. Something like:

class MyPrinter : public KPrinter
{
public:
	...
	void doPreparePrinting() { preparePrinting(); }
}

MyPrinter prt;
if (prt.setup(this))
{
	prt.doPreparePrinting();
	// continue with printing
}

Michael.

> -----Original Message-----
> From: Stefan Kebekus [mailto:kebekus at kde.org]
> Sent: Monday, March 29, 2004 11:30
> To: kde-core-devel at mail.kde.org
> Subject: Bug in KDEPrint/CUPS
> 
> 
> Hello,
> 
> I have recently received a bug report (#70681) because KDVI 
> does not properly 
> print in landscape mode. I believe that this is an issue of 
> the CUPS-KDEprint 
> system rather than KDVI; KGhostView seems to have similar issues. 
> 
> KDVI uses the kprinter to show the printing dialog, and then 
> generates 
> PostScript files itself, using the 'dvips' program. The value of 
> printer->orientation() is converted to the appropriate 
> command-line arguments 
> of dvips. Eventually, the resulting PostScript file is 
> printed using the 
> printFiles()-method of kprinter. This method works fine if I 
> print to a file, 
> or if I print using the "Generic UNIX LPD Print System", but 
> does not work at 
> all if I use the "Common UNIX Print System". If CUPS is chosen, 
> printer->orientation() always returns 0, and accordingly, no 
> landscape 
> printing takes place.
> 
> Best,
> 
> Stefan Kebekus.
> 
> -- 
> Maintainer of KDVI
> 
> http://devel-home.kde.org/~kdvi
> 




More information about the kde-core-devel mailing list