[cups] Acquire paper and tray info

Johannes Meixner jsmeix at suse.de
Thu Jan 22 02:55:43 PST 2015


Hello,

On Jan 21 12:46 Paul Mitchell wrote (excerpt):
> Alas, they printed in duplex and I need it to be simplex...

Simplest solutions is probably to set in the printer device itself
(via the buttons on the printer device itself) to use simplex mode
by default because it seems currently the printer device uses
duplex mode by default.

Alternatively try to completly re-set the printer device
it its factory default settings so that you have a clean
known state of your printer device.



> So, looking around online, I came up with this modification
> to the interfaces script:
>
> # PJL init: single-sided
> echo -en '\033%l0S'
> # PJL init: Send "Universal Exit Language" command
> echo -en '\033%-12345X'

This cannot work because <esc>&l0S is a PCL command, see
http://www.pclviewer.com/de/resources/reference/

What you need in your case is a PJL command.

Do not mix up the different languages PCL versus PJL versus PostScript.
When you switched the printer into PJL language mode, you can
only send PJL language to the printer.

I think the following PJL command should work:

@PJL SET DUPLEX=OFF

see
http://h20564.www2.hp.com/hpsc/doc/public/display?docId=emr_na-bpl01965
and
http://virtual.clemson.edu/groups/mathsci/documents/hp/pjl_command_files/pjl_command.htm

If you use

@PJL DEFAULT DUPLEX=OFF

you change the default setting in the printer device
not only the setting for the current print job.

In the end when this data
----------------------------------------------------------
<ESC>%-12345X
@PJL SET USERMEDIANAME="DV02"
@PJL SET DUPLEX=OFF
@PJL ENTER LANGUAGE = POSTSCRIPT
%!
/Helvetica findfont 20 scalefont setfont
100 200 moveto
(Hello) show
showpage
<EOT>
<ESC>%-12345X
----------------------------------------------------------
is sent to the printer device it should print a sheet
of paper with "Hello" on it in simplex mode.


Furthermore it seems good to set the printer back to its
default state after the print job via

@PJL INITIALIZE

so that a "System V style interface script" may look like:
--------------------------------------------------------------
#! /bin/bash
# see "man 7 filter"
# debug info in /var/log/cups/error_log
set -x
# have the input at fd0 (stdin) in any case
[ -n "$6" ] && exec <"$6"
# PJL init: Send "Universal Exit Language" command
echo -en '\033%-12345X'
# PJL reset to printer defaults
echo -en '@PJL INITIALIZE\n'
# PJL settings
echo -en '@PJL SET USERMEDIANAME="DV02"\n'
echo -en '@PJL SET DUPLEX=OFF\n'
# PJL switch to PostScript
echo -en '@PJL ENTER LANGUAGE = POSTSCRIPT\n'
# Send the PostScript
cat -
# PostScript end of transmission
echo -en '\004'
# PJL finish
echo -en '\033%-12345X'
# PJL reset to printer defaults
echo -en '@PJL INITIALIZE\n'
# PJL end
echo -en '\033%-12345X'
--------------------------------------------------------------

For full documentation see HP's PJL Referece (PDF) at
http://h20565.www2.hp.com/hpsc/doc/public/display?docId=emr_na-bpl13208

You may Google for "pjl reference" to get an URL or see
http://en.wikipedia.org/wiki/Printer_Job_Language


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