Hey Paul,  Do you (or anyone else) know how to tell a LaserJet to draw paper
from a specific tray?

-----Original Message-----
From: Paul Trebbien [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 20, 2005 5:34 PM
To: 'u2-users@listserver.u2ug.org'
Subject: RE: [U2] LPTR / SETPTR / landscape orientation example


Hi Andy,
        Looks like several posts, did you resolve this?

        I saw a couple of suggestions in the emails, here's my 2 cents for a
program that will set the setting for an HP Laserjet.  Note, we have a
printer definitions files where you enter the 'hex' codes for the escape
sequences to setup the printer and a hex escape sequence to return the
printer to the default settings.  This is very nice as the user logs on he
has a default printer, he can change the printer (from a menu), or a process
can be defined to use only the specified printer.  Anyway, when user prints
the 'software' know which printer is to be used and sends the 'setup' escape
sequence and when the print job is complete the 'software' sends the 'reset'
escape sequence to the printer.
        Here is an example program for this and at the end a list of hex
commands for a few HP Laserjet and Epson LQ printers - these are old lists
and hopefully contain the correct codes.

** PROGRAM : SETUP.HP.LASERJET
** PURPOSE : Send Escape Codes to HP LaserJet
**
INPUT ANS
**
GOT.CODE=0
BEGIN CASE
  CASE ANS="L" ; CODE="1B266C314F" ; GOT.CODE=1 ;* Set Landscape mode
  CASE ANS="P" ; CODE="1B266C304F" ; GOT.CODE=1 ;* Set Portrait mode
  CASE ANS="R" ; CODE="1B45"       ; GOT.CODE=1 ;* Reset to Default
  CASE 1
END CASE
IF GOT.CODE THEN
  PRINT ICONV(CODE,'MX'):
END
*
END




HP LASERJET
HEX COMMAND: DESCRIPTION:
1B45                    Reset
1B266C314F              Landscape
1B266C304F              Portrait 
1B283855 HP     Roman8
1B28733070              Fixed Spacing
31302E303068    10.00 Characters per Inch
31322E3076              12.0 Point Size
3073                    Upright Style
3062                    Normal Stroke Weight
3354                    Courier Typeface
1B266C3644              6 Lines per Inch
1B266C3145              1 line Top Margin
1B266C343946    49 lines Text Length
1B266C363446    64 lines Text Length

EPSON LQ and compatible printers
HEX COMMAND: DESCRIPTION:
Here is a breakdown of what each of these codes mean:
1B40 ====> RESET/INITIALIZE PRINTER
1B50 ====> SELECT PICA PRINT (10 CPI)
1B0F ====> SELECT COMPRESSED PRINT (17 CPI)
1B7830 ==> SELECT DRAFT FONT
1B7831 ==> SELECT NLQ (NEAR-LETTER-QUALITY) FONT
1B4315 ==> SET 21 LINES/PAGE (WHERE 15 HEX = 21 DEC)
1B4316 ==> SET 22 LINES/PAGE (WHERE 16 HEX = 22 DEC)
1B4321 ==> SET 33 LINES/PAGE (WHERE 21 HEX = 33 DEC)
1B432A ==> SET 42 LINES/PAGE (WHERE 2A HEX = 42 DEC)
1B4333 ==> SET 51 LINES/PAGE (WHERE 33 HEX = 51 DEC)
1B433C ==> SET 60 LINES/PAGE (WHERE 3C HEX = 60 DEC)
1B4342 ==> SET 66 LINES/PAGE (WHERE 42 HEX = 66 DEC)
1B4F ====> DISABLE SKIP OVER PERFORATION MODE
0D ======> CARRIAGE RETURN (FLUSH BUFFER, PROCESS COMMAND)

An example of a program to set an HP Laserjet printer to Landscape and then
to Reset printer back:




> Paul Trebbien
> Kore Technologies, Senior Support Tech. 
> "Solutions that work. People who care."
> V 858.678.0030 F 858.300.2600 W koretech.com
> 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Andy Pflueger
Sent: Monday, September 19, 2005 5:26 AM
To: U2 User Group Mailing List
Subject: [U2] LPTR / SETPTR / landscape orientation example


Hi gang,

I'm in the process of tweaking one of our reports which use a "LIST ...
LPTR" command line to spool the output to the default printer. However, the
results are too wide for portrait orientation and was wanting to find a way
to set the orientation with SETPTR prior to the execution of the LIST
statement.

I tried to use the following statement but that doesn't seem to change the
default orientation of the printer:

UDTEXECUTE 'SETPTR 0,,,,,1,,"Orientation=LANDSCAPE"' CAPTURING ASPMSG

More code pasted below:

095: *
096: *-- SELECTION
097: *
098: PRINT @(0,21):@(-4):"Sort/Select in progress..."
099: START.DATE=OCONV(START.DATE,'D2/')
100: END.DATE=OCONV(END.DATE,'D2/')
101: INIT.CMD='SELECT JOB.MATL WITH'
102: IF START.PERIOD # END.PERIOD THEN
103: INIT.CMD := ' CONO_WPER GE "':CONO:START.PERIOD:'" AND WITH CONO_WPER
LE "':CONO:END.PERIOD:'"'
104: END ELSE
105: INIT.CMD := ' CONO_WPER EQ "':CONO:START.PERIOD:'"'
106: END
107: UDTEXECUTE INIT.CMD CAPTURING ASPMSG
108: *
109: UDTEXECUTE 'SETPTR 0,,,,,1,,"Orientation=LANDSCAPE"' CAPTURING ASPMSG
110: CMD = 'LIST JOB.MATL BY CTR BY JOB BY PERIOD BY DATE BY TRANS WITH'
111: IF DEPT.IN <http://DEPT.IN> # 'ALL' THEN
112: CMD:=' JMT.DEPT = "':DEPT.IN:'"'
113: IF DEPT.IN <http://DEPT.IN> = '23' THEN
114: CMD:=' AND WITH GJOB.CHECK # ""'
115: CMD:=' AND WITH P.QTY > "0"'
116: END
117: END
118: IF START.DATE NE END.DATE THEN
119: CMD:=' AND WITH DATE GE "':START.DATE:'" AND WITH DATE LE "':END.DATE:
'"'
120: END ELSE
121: CMD:=' AND WITH DATE EQ "':START.DATE:'"'
122: END
123: IF BEG.JOB.NUM # "ALL" THEN
124: CMD:=' AND WITH JOB GE "':BEG.JOB.NUM:'" AND WITH JOB LE "':
END.JOB.NUM:'"'
125: END
126: CMD:=' ID-SUPP'
127: IF DEPT.IN <http://DEPT.IN> = 'ALL' THEN
128: CMD:=' BREAK-ON NP-DIV.DESC "':"'V'":'"'
129: CMD:=' BREAK-ON NP-JOB.DESC "':"'V'":'"'
130: END
131: CMD:=' JOB PROD JMT.R.S.ID <http://JMT.R.S.ID> WHSE CTR TYP CUST TRANS
PERIOD DATE RC.JOB RC.TRAN'
132: CMD:=' TOTAL P.QTY TOTAL S.QTY UM TOTAL MATL.COST TOTAL SALE'
133: CMD:=' HEADING "':"'TLC'":' JOB MATERIAL HISTORY REPORT ':"'LC'"
134: CMD:=' PERIOD ':START.PERIOD:' THUR ':END.PERIOD:' - DATE ':START.DATE
135: CMD:=' THROUGH ':END.DATE:" 'L'":'" GRAND-TOTAL'
136: CMD:=' " TOTAL FOR COMPANY - ':"'U'":'"'
137: CMD:=' LPTR '
138: EXECUTE CMD CAPTURING ERRMSG

I've checked numerous manuals and reference materials I have readily
available to me and can't seem to find a decent example of what I'm trying
to accomplish. I know I could re-write this report to not use the "LIST ...
LPTR" statement but instead use PRINTER ON, PRINT, and PRINTER OFF
commands...wanted to try avoid having to re-write the report at the present
time though.

TIA,
Andy
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

______________________________________________________________________
This e-mail has been scanned by MCI Managed Email Content Service, using
Skeptic(tm) technology powered by MessageLabs. For more information on MCI's
Managed Email Content Service, visit http://www.mci.com.
______________________________________________________________________

______________________________________________________________________
This e-mail has been scanned by MCI Managed Email Content Service, using 
Skeptic(tm) technology powered by MessageLabs. For more information on MCI's 
Managed Email  Content Service, visit http://www.mci.com.
______________________________________________________________________
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to