[cups] Acquire paper and tray info

Johannes Meixner jsmeix at suse.de
Mon Jan 12 03:55:02 PST 2015


Hello,

On Jan 11 16:22 Paul Mitchell wrote (excerpt):
> After turning on "debug" and sending an IPP file through it, I discovered
> that "request file type is application/postscript." So my question is,
> if that becomes the default type which is queued on the printer
> (which is  defined as a "raw" device) is any psto* filter employed?

Not any kind of filter is run for a "raw" queue, see "raw" at
https://en.opensuse.org/SDB:CUPS_in_a_Nutshell

When a "System V style Interface Script" is specified when the queue
is set up, then this "System V style Interface Script" is the only
filter that is run, see "etc/cups/interfaces/" at
https://en.opensuse.org/SDB:CUPS_in_a_Nutshell

In your particular case (because you have a PostScript printer)
the Windows driver produces PostScript (which matches your
observation that on the CUPS server what comes in from Windows
has "request file type is application/postscript").

When the Windows driver for a PostScript printer produces
plain PostScript it may look like
--------------------------------------------------------------------
%!
/Helvetica findfont 20 scalefont setfont
100 200 moveto
(Hello) show
showpage
--------------------------------------------------------------------
cf. http://en.wikipedia.org/wiki/PostScript#.22Hello_world.22

But often the Windows driver for a PostScript printer produces
not only plain PostScript but an additional PJL header before the
actual PostScript and some stuff after the actual PostScript like
--------------------------------------------------------------------
<ESC>%-12345X at PJL
@PJL ENTER LANGUAGE = POSTSCRIPT
%!
/Helvetica findfont 20 scalefont setfont
100 200 moveto
(Hello) show
showpage
<EOT><ESC>%-12345X
--------------------------------------------------------------------
(<ESC> is hex 1B and <EOT> is hex 04 ASCII character)
cf. http://en.wikipedia.org/wiki/Printer_Job_Language
and http://welp.stethos.com/online-help/uel.html
and http://en.wikipedia.org/wiki/End-of-transmission_character

To capture exactly what is sent to your CUPS server by your
particular Windows driver or application, see
"To get what the application submits to CUPS do the following" at
https://en.opensuse.org/SDB:How_to_Report_a_Printing_Issue

You need to konw what exactly is sent to your CUPS server by
your particular Windows driver or application to be able to make
your "System V style Interface Script" so that it changes what
was sent by Windows to the CUPS server to what will be sent to
your particular printer device by CUPS as you need it.

A "System V style Interface Script" gets as input at stdin or as a
filename via argv[6] that is $6 for shell scripts, see "man 7 filter"
what was sent as print job data to CUPS and it must output at stdout
what should be sent to the printer device, see
https://en.opensuse.org/SDB:Using_Your_Own_Filters_to_Print_with_CUPS

For example you may like to add a line @PJL SET USERMEDIANAME="DV02"
by your "System V style Interface Script" so that what is sent to
the printer device becomes like
--------------------------------------------------------------------
<ESC>%-12345X at PJL
@PJL SET USERMEDIANAME="DV02"
@PJL ENTER LANGUAGE = POSTSCRIPT
%!
/Helvetica findfont 20 scalefont setfont
100 200 moveto
(Hello) show
showpage
<EOT>
<ESC>%-12345X
--------------------------------------------------------------------
cf.
https://en.opensuse.org/SDB:Using_Your_Own_Filters_to_Print_with_CUPS

Also a "System V style Interface Script" gets the command-line arguments
and all the CUPS environment variables that are described in "man 7 filter"
so that you can make your "System V style Interface Script" behaving
according to its command-line arguments and environment.


Kind Regards
Johannes Meixner
-- 
SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild,
Dilip Upmanyu, Graham Norton - HRB 21284 (AG Nuernberg)




More information about the cups mailing list