|
|
Need to switch printer trays on the
fly while printing? Check out this tech tip and see how it's done.
|
The purpose of this
tech tip is to illustrate a way to print from multiple trays on an HP2400
printer from a BASIC program by sending the appropriate escape sequences
to the printer.
This is very useful when you need to print different documents on the
same printer and they need different paper size, type, color,
letterhead, etc. As a practical example, while printing the shipping documents
you might need the Shipper to print on the paper from Tray 2 and the Packing List on the paper
from Tray 3 with each printer tray containing a different colored paper.
Note: the test program below contains all of the Tray Options which were copied from the
HP manual which was
downloaded from the HP website. You may need to change the Form
Feed variable for your system.
$INCLUDE PV.INCLUDES SYSTEM.EQUATES
CALL HW.SYSTEM(HW.FF,FF)
Here's the full
test program, compatible with DataFlo Version 5.4 and higher. Try this
sample program on your system and once you get it working, use the code
in your own programs, inserted at the appropriate points in the program
when you need to switch paper trays.
** PROGRAM : Z.HP2400.PRINT.TRAYS
** PURPOSE : Test sending escape command to printer to switch trays
** AUTHOR : pault,04-12-06, Kore Technologies, LLC
*******************************************************************
* Note on Trays, 1 is the Manual feed, 2 & 3 are the storage ones.
* Here's the command: Ec&l#H
* Here are the Tray Options (#):
* 0 = Prints or ejects current page
* 1 = Tray 2
* 2 = Manual feed, paper
* 3 = Manual feed, envelope
* 4 = Tray 1
* 5 = Tray 3
* 6 = Optional envelop feeder
* 7 = Auto select
* 8 = Tray 4
* 20 to 69 = external trays
* So, to print from Tray 2 replace the # in Ec&l#H with a 1
* giving us Ec&l1H then convert that to hex for printing, 1B266C3148
*******************************************************************
FF = CHAR(12) ;* Char 12 works for UniVerse (Pick flavor)
TRAY2 = "1B266C3148"
TRAY3 = "1B266C3548"
PRINT ICONV(TRAY2,'MX'):
PRINT "Printing from Tray 2"
PRINT FF
PRINT ICONV(TRAY3,'MX'):
PRINT "Printed from Tray 3"
PRINT FF
* Switch back to Tray 2 as we are assuming that is the default tray
PRINT ICONV(TRAY2,'MX')
END
We hope you find this tech tip as useful. As always, if
you have any question on how to do any of this, please call us.
|