Kore Tech Tip
How to Print From Multiple Trays HP LaserJet
Tip
#1019

Printing from Multiple Trays on an HP2400 Series LaserJet

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.
  • DataFlo systems – Replace the FF=CHAR(12) line with these 2 lines to let DataFlo figure out what the Form Feed character is:
    $INCLUDE PV.INCLUDES SYSTEM.EQUATES
    CALL HW.SYSTEM(HW.FF,FF)
    
  • Other systems –You’ll need to define the FF variable with the Form Feed Character for your system.
    • For UniVerse, you can use:
      FF=CHAR(12)
      
    • For UniData, use both character 12 and 13, FF=CHAR(12)
      FF=CHAR(12):CHAR(13)
      

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.
 
 
 
Our technical tips are provided to help you find new or easier ways to solve some of your technical challenges or to show you a new technique. We hope you find them useful. Please contact us if you would like to share one of your Tech Tips or need help solving a technical challenge. We would be happy to help you.