[cups.general] Printing multiple copies when file comes from stdin?

Helge Blischke h.blischke at srz.de
Fri Mar 4 05:19:18 PST 2005


Steve Bergman wrote:
> 
> It seems that the "lpr -#" and  "lp -n" options do not work when the
> input file to lp/lpr comes from stdin.
> 
> i.e. ls  -l | lp -n2
> 
> only prints one copy.  Looking into the matter, I notice that the
> backend gets called differently depending upon how lp/lpr was called.
> in the above example, the backend gets called with 6 arguments and takes
> its input from stdin.
> 
> However,
> 
> lp -n3 /etc/inittab
> 
> results in the backend being called with an extra argument which is the
> file name.
> 
> The problem, if I am reading the code of the backend correctly, is that
> to do multiple copies, it reads the file, lseeks back to the beginning
> and then writes it out again.  stdin can't be lseeked back to 0 so you
> only get 1 copy.
> 
> This all seems quite odd, as when lp takes its input from stdin, a spool
> file still get's created in the /var/spool/cups directory.  Why does the
> backend get called in such a way that the "-n" option, which is a
> documented option, does not work?
> 
> Any help greatly appreciated.
> 
> Thanks,
> Steve Bergman

You didn't tell what CUPS version you are using. Generally, if the
printer
supports collated copies, the number of copies requested will be
inserted
into the PostScript stream. Only if the printer is known not to support
collated copies, the input (without the header, prolog, and setup)
is copied the respective times to the printer, regardless of the input
source.

But that may fail if the print data are not DSC compliant.

Helge

-- 
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de
tel: +49 30 75301-360




More information about the cups mailing list