Question about duplex printing

Cristian Tibirna tibirna at kde.org
Tue Jul 25 06:39:54 CEST 2006


On 24 July 2006 17:02, Albert Astals Cid wrote:
> Hi, how can i know if the user selected duplex printing or not in the
> kdeprint dialog?

"duplex" (or, more correctly named, "two-sided") printing is a property of the 
printing device. This is why sometimes this option is active in kprinter, 
sometimes it is not (if the printer doesn't have the capability).

In order to access options set in kprinter, one uses the

KPrinter::option()
KPrinter::setOption()
KPrinter::options()
KPrinter::setOptions()

methods (the first ones accept the option name as a parameter). This will 
return the values of options as set by the user after the display of the 
dialog, just before it hits "Print".

Given that the "duplex" option is a particularity of device (cups) driver 
implementation, the actual option might have different names from device to 
device.

I think that, in relation to this particular option, you might want to think 
of KPrinter as of a post-processing tool. I.e., your app. provides the PS/PDF 
and KPrinter will direct it to the device with user's option selection 
attached. It will be the device/printer that will actually take care of the 
duplexing.

I know that it might seem frustrating to let the user actually decide if he 
wants a particular type of formatting based on his knowledge of printer 
capabilities. But sorry, I don't have right now a clear and tested solution 
(or lack of) of how (or if possible) to query KPrinter about particular CUPS 
properties (presence, relevance and value) from inside an application. So I 
can't (right now) advise you of the precise capabilities. More code 
exploration and some handcoded tests wil clarify this point.

> I need to know that so i can pass it to poppler to generate the PS
> accordingly.
>
> Or should i always create a non duplex PS and kdeprint will modify it
> accordingly?

Would your duplex PS differ from a non-duplex one in which ways? Margins and 
offsets? Something else?


-- 
Cristian Tibirna
KDE developer .. tibirna at kde.org .. http://www.kde.org


More information about the kde-print mailing list