[cups.general] How do I force duplex when printing?

Helge Blischke h.blischke at acm.org
Wed Aug 5 07:42:44 PDT 2009


Mike Kasick wrote:

> Hi folks,
> 
> I'm running CUPS 1.3.11 on Debian sid.  I have a Brother HL-5250DN printer
> for which, I want every print job to print duplex whether they specify to
> or not.
> 
> Thus far I've configured the printer, through CUPS, to print duplex by
> default (i.e., PPD contains "*DefaultDuplex: DuplexNoTumble").  This works
> just fine for print jobs I submit on my Linux machines as they don't
> otherwise specify any contradictory duplex options.
> 
> I also have a Windows machine with the CUPS Test Driver v6 that prints via
> ipp.  Previously, it would also print duplex regardless of what the duplex
> settings were on the Windows machine (which, as I understood, were
> irrelevant since the driver was unaware of any duplexer).
> 
> However, as of recent, the Windows machine now always prints simplex.  I'm
> not sure if this is an incidental part of the Windows PostScript driver
> being updated, or if it's somehow related to a prior update of Debian
> CUPS. But the point is that every job I submit from the Windows machine
> contains
> the stanza "<</Duplex false>>setpagedevice", which disables duplexing.  I
> can't seem to change this in the Windows driver since it complains about
> the lack of a duplexer.  But frankly, I'd rather CUPS just override any
> duplex settings regardless of what the Windows postscript file specifies.
> 
> So is it possible to have CUPS override the duplex options when I print
> from Windows?  If so, what needs to be done to make this happen?
> 
> I tried Google to see if there was a howto for this or something, but most
> of what I found are folks complaining that CUPS overrides their Windows
> driver settings when they don't want them to--so I made no progress there.
> If anyone has a link or something like that, it would be greatly
> appreciated.
> 
> Thanks everyone!
> see

As your system uses CUPS as spooling system, I'd suggest modifying your 
printer's PPD as follows:

Just after the lines beginning with 
*%==== PostScript Patches =======

insert the following:

---snip---
*JobPatchFile 2: "
%%BeginFile: force_duplex 0.1 0
%%Copyright: 2009 by Helge Blischke
%%CreationDate: 2009-08-05
% Description:
% ------------
%       This PostScript snippet is designed to be used as a
%       JobPatchFile in a printer's PPD and performs the
%       following:
%       (1) sets the printer to duplex mode
%       (2) turns any following duplex statements to a noop.

% If the printer does not use the standard keys for duplex
% handling as specified in the PLRM, edit the following lines
% accordingly (refer to the printr's PPD for device specific
% keys):
/_Duplex        /Duplex         def
/_Tumble        /Tumble         def
%
% Save the original setpagedevice operator
/sys_setpagedevice /setpagedevice load def
% Force duplex printing
<< //_Duplex true //_Tumble false>> sys_setpagedevice
% Redefine setpagedevice to ignore specifying duplex on/off
/setpagedevice
{
        dup //_Duplex known{dup //_Duplex undef}if
        dup //_Tumble known{dup //_Tumble undef}if
        sys_setpagedevice
}bind def
% In case the printer understands level 1 duplexing operators
% (usually residing in statusdict), redefine them as noops here,
% following the template:
/setduplexmode where{pop userdict/setduplexmode {} put}if
%%EndFile
"
---snip---
(do not ignore the quotes!).

Let me know if it works as expected.

Helge






More information about the cups mailing list