The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads
 
  << Previous Topic | Next Topic >>Return to Index  

HP LaserJet Print Program

May 2 2012 at 1:31 AM
  (Login slowneutron)

******************************************************************************

***PRNTXTLJ.TXT***

1. The program PRNTXTLJ.BAS will print text files, QBasic programs and other similar files on a Hewlett Packard LaserJet 6L printer. Any size of paper, charactes per inch and line spacing within tha capability of the printer can be selected. 2 fixed pitch fonts (Courier and Letter Gothic) and 5 character sets are available including CP1252 (Windows extended ASCII), CP850 (MS-DOS Multilingual) and CP437 (IBM & MS-DOS PC8).

2. The program will detect embedded Hewlett Packard printer control language (PCL) escape sequences for underlined, bold and italic text:-

a. Start of fixed underlining (through descenders): ESC&d0D
b. Start of floating underlining (under descenders): ESC&d3D.
c. End of underlining: ESC&d@
d. Start of bold text: ESC(s3B
e. End of bold text: ESC(s0B
f. Start of italic text: ESC(s1S
g. End of italic text: ESC(s0S

(Note: For ESC in Notepad, press ALT + 27 on numeric key pad)

3. The program will detect embedded form feed (FF) control codes that are:-

a. At the beginning of lines or paragraphs.
b. At the end of lines or paragraphs before the carriage return line feed.
c. On a separate line followed by a carriage return line feed.

(Note: For FF in Notepad, press ALT + 12 on numeric keypad)

4. When printing at the top of a page, any gap lines before the text are ignored. If such gap lines are required when they coincide with the top of a page, beginning such gap lines with a space character will ensure that they are printed.

******************************************************************************

' *** PRNTXTLJ.BAS FOR HP LASERJET 6L ***
ESC$ = CHR$(&H1B): CR$ = CHR$(&HD): FF$ = CHR$(&HC): RST$ = ESC$ + "E"

'CHECK IF FILE PRESENT
PRINT : PRINT : INPUT "Enter filespec: ", FS$: FS$ = UCASE$(FS$)
OPEN FS$ FOR INPUT AS #1
IF EOF(1) THEN PRINT " File is empty": CLOSE 1: GOTO FINISH ELSE CLOSE 1

'PAPER SIZE & ORIENTATION
'SET UP ISO PAPER SIZE ARRAY
DIM ia%(11), ib%(11)
FOR i% = 0 TO 11: READ ia%(i%): NEXT i%
FOR i% = 0 TO 11: READ ib%(i%): NEXT i%
'INPUT PAPER SIZE, PRINTING ORIENTATION AND No OF COPIES
IF$ = " Incorrect format": IC$ = "Invalid No of copies": IO$ = "Invalid ISO size"
PRINT : PRINT "Paper size: ISO A4 to A6, B5 to B7"
PRINT " Width: 3 inches to 8.5 inches"
PRINT " Length: 5 inches to 14 inches plus"
PRINT " If over 14 inches, bottom margin increases (portrate) or left margin increases (landscape)"
SIZE: PRINT : PRINT "Enter paper size (ISO or width X length), printing orientation and No of copies"
INPUT " (eg <A4,P,6>, <B5,L,1>, <8.5X11,P,2>): ", PS$, O$, NM$
IF PS$ = "" OR O$ = "" OR NM$ = "" THEN PRINT IF$: GOTO SIZE
PS$ = UCASE$(PS$): O$ = UCASE$(O$): ln% = LEN(PS$): REDIM PS$(ln%)
'STORE PAPER SIZE STRING CHARACTERS IN ARRAY
FOR i% = 1 TO ln%: PS$(i%) = MID$(PS$, i%, 1): NEXT i%
'CHECK No OF COPIES, ESTABLISH PRINTING ORIENTATION AND SET PRINTING ORIENTATION COMMAND
nc% = VAL(NM$): IF nc% < 1 THEN PRINT IC$: GOTO SIZE
IF O$ = "P" THEN POC$ = ESC$ + "&l0O" ELSE IF O$ = "L" THEN POC$ = ESC$ + "&l1O" ELSE PRINT IF$: GOTO SIZE
'ESTABLISH IF ISO SIZE
IF PS$(1) = "A" OR PS$(1) = "B" THEN
IF (PS$(2) >= "0" AND PS$(2) <= "9") AND (MID$(PS$, 3, 1) = "0" OR (MID$(PS$, 3, 1) = "")) THEN
in% = VAL(MID$(PS$, 2))
ELSE
PRINT IO$: GOTO SIZE
END IF

'CALCULATE ISO SIZE WIDTH AND LENGTH
IF PS$(1) = "A" THEN
w! = ia%(in% + 1) / 25.4: l! = ia%(in%) / 25.4
ELSEIF PS$(1) = "B" THEN
w! = ib%(in% + 1) / 25.4: l! = ib%(in%) / 25.4
END IF
'NOT ISO SIZE
ELSE
'FIND X BETWEEN PAPER WIDTH AND LENGTH
h% = 0: x% = 0
FOR i% = 2 TO ln% - 1: IF PS$(i%) = "X" THEN h% = h% + 1: x% = i%
NEXT i%
IF h% = 1 THEN
PW$ = LEFT$(PS$, x% - 1): PL$ = MID$(PS$, x% + 1, ln% - x%)
ELSE
PRINT IF$: GOTO SIZE
END IF

'CHECK FORMAT OF PAPER WIDTH STRING AND CALCULATE WIDTH
h% = 0
FOR i% = 1 TO x% - 1
IF PS$(i%) = "." THEN
h% = h% + 1
ELSEIF PS$(i%) < "0" OR PS$(i%) > "9" THEN
PRINT IF$: GOTO SIZE
END IF
NEXT i%
IF h% <= 1 THEN w! = VAL(PW$) ELSE PRINT IF$: GOTO SIZE
'CHECK FORMAT OF PAPER LENGTH STRING AND CALCULATE LENGTH
h% = 0
FOR i% = x% + 1 TO ln% - 1
IF PS$(i%) = "." THEN
h% = h% + 1
ELSEIF PS$(i%) < "0" OR PS$(i%) > "9" THEN
PRINT IF$: GOTO SIZE
END IF
NEXT i%
IF h% <= 1 THEN l! = VAL(PL$) ELSE PRINT IF$: GOTO SIZE
END IF
'ROUND PAPER SIZES TO TWO DECIMAL PLACES
c% = 100: w! = CINT(w! * c%) / c%: l! = CINT(l! * c%) / c%
IF l! > 14 THEN XL$ = STR$(CINT((l! - 14) * c%) / c%)

'SET UP STRINGS FOR PAPER SIZE CHECK
IF O$ = "P" THEN ON$ = "landscape": MN$ = "Bottom"
IF O$ = "L" THEN ON$ = "portrate": MN$ = "Left"
T1$ = "Paper too wide for printer"
T2$ = "Paper too narrow for printer"
T3$ = "Paper too short for printer"
T4$ = "Use paper 3 inches or wider"
T5$ = "Use paper 3 inches or longer"
T6$ = "Use paper 5 inches or longer"
T7$ = "Use paper 8.5 inches or narrower"
T8$ = "Use paper 3 x 5 inches or larger"
T9$ = "Retain current settings"
T10$ = "Turn paper 90 degrees, exchange width and length settings "
T11$ = "and print in " + ON$ + " orientation"
T12$ = "Cut to size after printing"
T13$ = "Note that length exceeds printer max of 14 inches"
T14$ = MN$ + " margin will increase by" + XL$ + " inches"
S1$ = "Enter A to abandon, R to re-enter paper sizes"
S2$ = ", C to continue"

'CHECK PAPER SIZE SUITABLE FOR PRINTER
IF w! > 8.5 THEN
PRINT : PRINT T1$
IF l! < 3 THEN
PRINT T3$: PRINT T5$: PRINT T10$: PRINT T11$: PRINT T12$
GOTO AORR
ELSEIF l! <= 8.5 THEN
PRINT T10$: PRINT T11$
GOTO AORR
ELSEIF l! > 8.5 THEN
PRINT T7$
IF l! > 14 THEN PRINT T13$: PRINT T14$
GOTO AORR
END IF

ELSEIF w! >= 3 THEN
PRINT
IF l! < 5 THEN
PRINT T3$: PRINT T6$: PRINT T9$: PRINT T12$
GOTO ARORC
ELSEIF l! <= 14 THEN
GOTO CHRS1
ELSEIF l! > 14 THEN
l! = 14: PRINT T13$: PRINT T14$
GOTO ARORC
END IF

ELSEIF w! < 3 THEN
PRINT : PRINT T2$
IF l! < 5 THEN
PRINT T3$: PRINT T8$: PRINT T10$: PRINT T11$: PRINT T12$
GOTO ARORC
ELSEIF l! >= 5 THEN
PRINT T4$: PRINT T9$: PRINT T12$
IF l! > 14 THEN l! = 14: PRINT T13$: PRINT T14$
GOTO ARORC
END IF
END IF

'CHANGE OPTIONS
AORR: PRINT : PRINT S1$; : INPUT ": ", AR$: AR$ = UCASE$(AR$)
IF AR$ = "A" THEN GOTO FINISH ELSE IF AR$ = "R" THEN GOTO SIZE ELSE GOTO AORR
ARORC: PRINT : PRINT S1$; S2$; : INPUT ": ", AR$: AR$ = UCASE$(AR$)
IF AR$ = "A" THEN GOTO FINISH ELSE IF AR$ = "R" THEN GOTO SIZE ELSE IF AR$ = "C" THEN GOTO CHRS1 ELSE GOTO ARORC

'INPUT CHARACTERS/INCH, LINES/INCH, CHARACTER SET, FONT AND PRINT QUALITY
CHRS1: PRINT
PRINT " | Characters/inch: 1 to 120 || Font: C Courier |"
PRINT " | || G Gothic |"
PRINT " | Lines/inch: 1,2,3,4,6,8,12,16,24,48 || |"
PRINT " | || |"
PRINT " | Character sets: || |"
PRINT " | Windows extended ASCII CP 1252: A || Print quality: |"
PRINT " | Latin 1 ISO 8859/1 (ECMA-94): L || Normal N |"
PRINT " | MS-DOS MULTILINGUAL CP 850: M || Draft (economy mode) D |"
PRINT " | IBM-DOS & MS-DOS PC-8 CP 437: I || |"
PRINT " | UK (#>pound, No 80H>FFH) ISO 4: U || |"
CHRS2: PRINT : PRINT "Enter characters/inch, lines/inch, character set, font and print quality"
INPUT "(eg <10,6,A,C,N>, <12,6,M,G,D>, <16,8,I,C,N>): ", ci%, li%, CS$, F$, EM$: CS$ = UCASE$(CS$): F$ = UCASE$(F$): EM$ = UCASE$(EM$)
'CHECK CHRS/INCH VALID
IF ci% < 1 OR ci% > 120 THEN PRINT " Chrs/inch invalid": GOTO CHRS2
'CHECK LINES/INCH VALID
IF NOT (li% = 1 OR li% = 2 OR li% = 3 OR li% = 4 OR li% = 6 OR li% = 8 OR li% = 12 OR li% = 16 OR li% = 24 OR li% = 48) THEN
PRINT : PRINT "Lines/inch invalid": GOTO CHRS2
END IF
'SET PRINTER COMMAND FOR CHARACTER SET
IF CS$ = "A" THEN
CSC$ = ESC$ + "(19U"
ELSEIF CS$ = "L" THEN
CSC$ = ESC$ + "(0N"
ELSEIF CS$ = "M" THEN
CSC$ = ESC$ + "(12U"
ELSEIF CS$ = "I" THEN
CSC$ = ESC$ + "(10U"
ELSEIF CS$ = "U" THEN
CSC$ = ESC$ + "(1E"
ELSE
PRINT : PRINT "Character set invalid": GOTO CHRS2
END IF
'SET PRINTER COMMAND FOR FONT
IF F$ = "C" THEN
FC$ = ESC$ + "(s4099T"
ELSEIF F$ = "G" THEN
FC$ = ESC$ + "(s4102T"
ELSE
PRINT : PRINT "Font invalid": GOTO CHRS2
END IF
'SET PRINTER JOB LANGUAGE STRING FOR NORMAL OR DRAFT (ECONOMY MODE)
IF EM$ = "D" THEN
EMC$ = "ON"
ELSEIF EM$ = "N" THEN
EMC$ = "OFF"
ELSE PRINT : PRINT "Print quality invalid": GOTO CHRS2
END IF

'ESTABLISH MARGINS, PRINTING WIDTH AND LENGTH
rwx! = 8: rwn! = 5: rlx! = 10: rln! = 6
IF O$ = "L" THEN SWAP w!, l!: SWAP rlx!, rwx!: SWAP rln!, rwn!

'CALCULATE TOP AND BOTTOM MARGINS AND PRINTING LENGTH IN LINES
tmx! = 1: tmn! = .5: tmpa! = -.125: tmla! = 0: bmx! = .75: bmn! = .375
IF l! >= rlx! THEN
tmi! = tmx!: bmi! = bmx!
ELSEIF l! <= rln! THEN
tmi! = tmn!: bmi! = bmn!
ELSE
tbr! = (l! - rln!) / (rlx! - rln!)
tmi! = tmn! + (tmx! - tmn!) * tbr!: bmi! = bmn! + (bmx! - bmn!) * tbr!
END IF
IF O$ = "P" THEN
tml% = tmi! * li%
tmla% = (tmi! + tmpa!) * li%
ELSEIF O$ = "L" THEN
tml% = tmi! * li%
tmla% = (tmi! + tmla! + (8.5 - l!) / 2) * li%
END IF
bml% = bmi! * li%: ll% = l! * li%
lpl% = ll% - tml% - bml%
IF lpl% < 1 THEN PRINT "Print length less than 1 line": GOTO AORR

'CALCULATE LEFT AND RIGHT MARGINS AND PRINTING WIDTH IN COLUMNS
lmx! = 1: lmn! = .5: lmpa! = -.25: lmla! = -.1875: rmx! = .5: rmn! = .25
IF w! >= rwx! THEN
lmi! = lmx!: rmi! = rmx!
ELSEIF w! <= rwn! THEN
lmi! = lmn!: rmi! = rmn!
ELSE
lrr! = (w! - rwn!) / (rwx! - rwn!)
lmi! = lmn! + (lmx! - lmn!) * lrr!: rmi! = rmn! + (rmx! - rmn!) * lrr!
END IF
IF O$ = "P" THEN
lmc% = lmi! * ci%
lmca% = (lmi! + lmpa! + (8.5 - w!) / 2) * ci%
ELSEIF O$ = "L" THEN
lmc% = lmi! * ci%
lmca% = (lmi! + lmla! + 14 - w!) * ci%
END IF
rmc% = rmi! * ci%: wc% = w! * ci%
wpc% = wc% - lmc% - rmc%
IF wpc% < 1 THEN PRINT "Print width less than 1 character": GOTO AORR

'PRINTER COMMANDS
'SET PAPER SIZE MAX, LINES/INCH, TOP MARGIN LINES,
'CHRS/INCH, LEFT MARGIN COLUMNS, AND LINE TERMINATION
PSC$ = ESC$ + "&l3A": LIC$ = ESC$ + "&l" + MID$(STR$(li%), 2) + "D"
TPML$ = ESC$ + "&l" + MID$(STR$(tmla%), 2) + "E": CIC$ = ESC$ + "(s" + MID$(STR$(ci%), 2) + "H"
LTMC$ = ESC$ + "&a" + MID$(STR$(lmca%), 2) + "L": LNT$ = ESC$ + "&k0G"
'SET QBASIC LPRINT WIDTH TO INFINATE
WIDTH LPRINT 255
'SEND ECONOMY MODE PRINTER JOB CONTROL COMMAND TO PRINTER
UEL$ = ESC$ + "%-12345X": PJL$ = "@PJL"
LPRINT UEL$ + PJL$
LPRINT PJL$ + " SET ECONOMODE = " + EMC$
'SEND PRINTER COMMANDS TO PRINTER
LPRINT RST$; PSC$; POC$; LIC$; TPML$; CIC$; LTMC$; CSC$; FC$; LNT$;

'SET UP UNDERLINE, ITALIC AND BOLD ESCAPE SEQUENCES ARRAY
FOR i% = 0 TO 9: READ ESQ$(i%): NEXT i%

'SET UP END OF LINE DELIMITER ARRAY
DIM D$(33)
FOR i% = 1 TO 33
READ dl%: D$(i%) = CHR$(dl%)
NEXT i%
IF CH$ = "L" OR CH$ = "M" OR CH$ = "I" OR CH$ = "U" THEN
FOR i% = 4 TO 6: D$(i%) = "": NEXT i%
FOR i% = 22 TO 27: D$(i%) = "": NEXT i%
END IF
IF CH$ = "M" OR CH$ = "I" THEN
D$(7) = CHR$(&HAE): D$(28) = CHR$(&HFF): D$(29) = CHR$(&HAD): D$(30) = CHR$(&HDD)
D$(31) = CHR$(&HF0): D$(32) = CHR$(&HAF): D$(33) = CHR$(&HA8)
END IF
IF CH$ = "I" THEN
D$(30) = "": D$(31) = ""
END IF
IF CH$ = "U" THEN
FOR i% = 28 TO 33: D$(i%) = "": NEXT i%
END IF

'INPUT TEXT, FIND FORM FEEDS,AND UNDERLINE, ITALIC AND BOLD ESCAPE SEQUENCES
DO WHILE nc% > 0
OPEN FS$ FOR INPUT AS #1: lno% = 0
DO WHILE NOT EOF(1)
LINE INPUT #1, FL$: lfl% = LEN(FL$): tf% = 0
DO
'CHECK FOR LEADING AND TRAILING FORM FEEDS
IF LEFT$(FL$, 1) = FF$ THEN
IF lno% > 0 THEN LPRINT FF$; : lno% = 0
FL$ = MID$(FL$, 2): lfl% = lfl% - 1
END IF
IF RIGHT$(FL$, 1) = FF$ THEN
lfl% = lfl% - 1: FL$ = LEFT$(FL$, lfl%): tf% = 1
END IF

'CHECK FOR ESCAPE SEQUENCES
wpe% = wpc%: wph% = wpc% \ 2: adl% = 0: i% = 0
DO
i% = i% + 1
IF MID$(FL$, i%, 1) = ESC$ THEN
ad% = 0
ESQ$ = MID$(FL$, i% + 1, 4)
FOR j% = 1 TO 9
IF ESQ$ = ESQ$(j%) THEN ad% = 5: EXIT FOR
NEXT j%
IF ad% = 0 AND LEFT$(ESQ$, 3) = ESQ$(0) THEN ad% = 4
IF ad% <> 0 THEN
wpe% = wpe% + ad%: adl% = adl% + ad%
IF i% <= wph% THEN wph% = wph% + ad%
ELSE
PRINT : PRINT "The program has encountered an escape sequence other than underline, italic or bold"
END IF
END IF
LOOP UNTIL i% = wpe% OR i% = lfl% + adl%

'CHECK FOR SHORT LINE
IF lfl% <= wpe% THEN
IF lfl% = 0 AND lno% = 0 THEN EXIT DO
LP$ = FL$: FL$ = "": GOTO LPRNT
END IF

'FIND LINE BREAKS AND PRINT
'CHECK FOR SPACE
FOR i% = wpe% + 1 TO wph% STEP -1
SA$ = MID$(FL$, i%, 1)
IF SA$ = " " THEN
LP$ = LEFT$(FL$, i% - 1): FL$ = MID$(FL$, i% + 1): GOTO LPRNT
END IF
NEXT i%
'CHECK FOR RIGHT FACING BRACKETS
FOR i% = wpe% + 1 TO wph% STEP -1
SA$ = MID$(FL$, i%, 1): SB$ = MID$(FL$, i% - 1, 1)
FOR j% = 1 TO 7
IF SA$ = D$(j%) AND SB$ <> ESC$ THEN
LP$ = LEFT$(FL$, i% - 1): FL$ = MID$(FL$, i%): GOTO LPRNT
END IF
NEXT j%
'CHECK FOR LEFT FACING BRACKETS AND PUNCTUATION
FOR j% = 8 TO 33
IF SB$ = D$(j%) THEN
LP$ = LEFT$(FL$, i%): FL$ = MID$(FL$, i% + 1): GOTO LPRNT
END IF
NEXT j%
NEXT i%
'NO SUITABLE LINE BREAK FOUND
LP$ = LEFT$(FL$, wpe%): FL$ = MID$(FL$, wpe% + 1)
LPRNT: LPRINT LP$; : lno% = lno% + 1: lfl% = LEN(FL$)
IF lno% < lpl% AND tf% = 0 THEN LPRINT ELSE LPRINT CR$ + FF$; : lno% = 0
LOOP WHILE lfl% > 0
LOOP
IF lno% > 0 THEN LPRINT CR$ + FF$;
CLOSE #1
nc% = nc% - 1
LOOP
LPRINT RST$;
FINISH: END

'ARRAY DATA
'ISO SIZE DIMENSIONS
DATA 1189,841,594,420,297,210,148,105,74,52,37,26
DATA 1414,1000,707,500,353,250,176,125,88,62,44,31

'HP PCL UNDERLINE, ITALIC AND BOLD ESCAPE SEQUENCES
DATA "&d@","&d0D","&d1D","&d2D","&d3D","&d4D","(s1S","(s0S","(s3B","(s0B"

'END OF LINE DELIMITERS
DATA &H28,&H5B,&H7B,&H8B,&H91,&H93,&HAB,&H21,&H29,&H2C,&H2D
DATA &H2E,&H2F,&H3A,&H3B,&H3F,&H5C,&H5D,&H5F,&H7C,&H7D,&H85
DATA &H92,&H94,&H96,&H97,&H9B,&HA0,&HA1,&HA6,&HAD,&HBB,&HBF

'THIS PROGRAM WILL PRINT TEXT FILES ON ANY SIZE OF PAPER
'AND IN ANY SIZE OF ANY OF THE INTERNAL FIXED PITCH FONTS
'WITHIN THE CAPABILITY OF THE HP LASERJET 6L PRINTER

******************************************************************************

VARIABLE LIST

INTEGER VARIABLES
ad% No of characters in escape sequence
adl% Total No of characters in escape sequences
bml% Bottom margin lines
c% 100 for rounding to 2 decimal places
ci% Characters/inch
dl% ASCII values of delimiters other than space
h% Counter for paper size strings
i% First counter
ia%() Array for ISO A sizes
ib%() Array for ISO B sizes
in% ISO size A or B Number
j% Second counter
lfl% Lenth of file line columns
li% Lines/inch
ll% Length of paper line columns
lmc% Left margin columns
lmca% Left margin columns adjusted
ln% Length of paper size string
lno% Line No on page
lpl% Length for printing lines
nc% Number of copies
rmc% Right margin columns
tf% Marker for trailing form feed
tml% Top margin lines
tmla% Top margin lines adjusted
wc% Width of paper columns
wpc% Width for printing columns
wpe% As wpe% but allowing for escape sequences
wph% Lower limit for line break search (=wpc%\2)
x% Array subscript No for "X" in paper size string

SINGLE PRECISION FLOATING POINT VARIABLES
bmi! Bottom margin inches
bmn! Bottom margin minimum inches
bmx! Bottom margin maximum inches
l! Paper length inches
lmi! Left margin inches
lmla! Left margin landscape adjuster inches
lmn! Left margin minimum inches
lmpa! Left margin portrate adjuster inches
lmx! Left margin maximum inches
lrr! Left and right margins ratio
rln! Reference length minimum inches
rlx! Reference lingth maximum inches
rmi! Right margin inches
rmn! Right margin minimum inches
rmx! Right margin maximum inches
rwn! Reference width minimum inches
rwx! Reference width maximum inches
tbr! Top and bottom margins ratio
tmi! Top margin inches
tmla! Top margin landscape adjuster inches
tmn! Top margin mimimum inches
tmpa! Top margin portrate adjuster inches
tmx! Top margin maximum inches
w! Paper width inches

STRING VARIABLES
AR$ Input string for abandon re-enter or continue
CIC$ Characters/inch printer command
CR$ Carriage return ^M
CSC$ Character set printer command
CS$ Character set string
D$() Array for delimeters other than spsce
EM$ String print quality "D" or "N"
EMC$ String for economy mode "ON" or "OFF"
ESC$ Escape code ^[
ESQ$ Escape sequencws
ESQ$() Array for underline, italic and bold escape sequences
F$ String for font "C" (courier) "G" (gothic)
FC$ String for font command
FF$ Form feed code ^L
FL$ File line string
FS$ Filespec string
IC$ String "Invalid number of copies"
IF$ String "Incorrect format"
IO$ String "Invalid ISO size"
LIC$ Lines/inch printer command
LNT$ Line termination printer command
LP$ Line for printing
LTMC$ Left margin printer command
MN$ String for "Bottom" or "Left"
NM$ String for entering No of copies
O$ Printing orientation
ON$ String for "portrate" or "landscape"
PJL$ String for PJL economy mode command
PL$ Paper length string
POC$ Printing orientation printer command
PS$ Paper size string
PS$() Array for paper size string characters
PSC$ Paper size printer command
PW$ Paper width string
RST$ Printer reset command
S1$ String "Enter A to Abandon R to re-enter . . . ."
S2$ String " C to continue"
SA$ Character being checked for line break
SB$ Character to the right of SA$
T1$ String "Paper too wide for printer"
T10$ String "Turn paper 90 degrees exchange width and . . ."
T11$ String "and print in " + ON$ + " orientation"
T12$ String "Cut to size after printing"
T13$ String "Note that length exceeds printer max of 14 . . ."
T14$ String MN$ + " margin will increase by" + XL$ + " inches"
T2$ String "Paper too narrow for printer"
T3$ String "Paper too short for printer"
T4$ String "Use paper 3 inches or wider"
T5$ String "Use paper 3 inches or longer"
T6$ String "Use paper 5 inches or longer"
T7$ String "Use paper 8.5 inches or narrower"
T8$ String "Use paper 3 x 5 inches or larger"
T9$ String "Retain current settings"
TPML$ Top margin printer command
UEL$ String for PJL economy mode command
XL$ String for increase in margin if over 14 inches

******************************************************************************

 
 Respond to this message   
AuthorReply

(Login slowneutron)

HP LaserJet Print Program

May 2 2012, 2:39 AM 

Please delete this post. I will post again with with non-breaking spsces.

 
 Respond to this message   

(Login MCalkins)
R

Re: HP LaserJet Print Program

May 3 2012, 2:10 AM 

I can't edit or delete posts in this subforum. Pete or Solitaire would have to do it.

As it seems you've figured out, you need to use NBSP (Alt+255 or Alt+0160). You can do use notepad to search and replace spaces with NBSP characters, or use a program like this:

'public domain, michael calkins
DIM i AS LONG
DIM b AS STRING * 1
DIM t AS STRING
LINE INPUT t
IF t = "" THEN t = "delme.bas"
OPEN t FOR INPUT AS 1
CLOSE
OPEN t FOR BINARY AS 1
OPEN "---tmp.txt" FOR OUTPUT AS 2
CLOSE 2
OPEN "---tmp.txt" FOR BINARY AS 2
FOR i = 1 TO LOF(1)
GET 1, , b
IF ASC(b) = &H20 THEN b = CHR$(&HA0)
PUT 2, , b
NEXT i
CLOSE
SHELL "notepad ---tmp.txt"
SYSTEM

Regards,
Michael

 
 Respond to this message   

(Login MCalkins)
R

Re: HP LaserJet Print Program

May 3 2012, 2:25 AM 

From the post:

HP LaserJet Print Program

Griffiths David (Login slowneutron)
Posted May 2, 2012 1:31 AM

spacing recovered by viewing forum page source, and editing in notepad.

----------





                     ***PRNTXTLJ.TXT***

1. The program PRNTXTLJ.BAS will print text files, QBasic programs and other similar files on a Hewlett Packard LaserJet 6L printer. Any size of paper, charactes per inch and line spacing within tha capability of the printer can be selected. 2 fixed pitch fonts (Courier and Letter Gothic) and 5 character sets are available including CP1252 (Windows extended ASCII), CP850 (MS-DOS Multilingual) and CP437 (IBM & MS-DOS PC8).

2. The program will detect embedded Hewlett Packard printer control language (PCL) escape sequences for underlined, bold and italic text:-

     a. Start of fixed underlining (through descenders): ESC&d0D
     b. Start of floating underlining (under descenders): ESC&d3D.
     c. End of underlining: ESC&d@
     d. Start of bold text: ESC(s3B
     e. End of bold text: ESC(s0B
     f. Start of italic text: ESC(s1S
     g. End of italic text: ESC(s0S

(Note: For ESC in Notepad, press ALT + 27 on numeric key pad)
 
3. The program will detect embedded form feed (FF) control codes that are:-

     a. At the beginning of lines or paragraphs.
     b. At the end of lines or paragraphs before the carriage return line feed.
     c. On a separate line followed by a carriage return line feed.

(Note: For FF in Notepad, press ALT + 12 on numeric keypad)

4. When printing at the top of a page, any gap lines before the text are ignored. If such gap lines are required when they coincide with the top of a page, beginning such gap lines with a space character will ensure that they are printed.

******************************************************************************

'         *** PRNTXTLJ.BAS FOR HP LASERJET 6L ***
ESC$ = CHR$(&H1B): CR$ = CHR$(&HD): FF$ = CHR$(&HC): RST$ = ESC$ + "E"

'CHECK IF FILE PRESENT
PRINT : PRINT : INPUT "Enter filespec: ", FS$: FS$ = UCASE$(FS$)
OPEN FS$ FOR INPUT AS #1
IF EOF(1) THEN PRINT "  File is empty": CLOSE 1: GOTO FINISH ELSE CLOSE 1

'PAPER SIZE & ORIENTATION
'SET UP ISO PAPER SIZE ARRAY
DIM ia%(11), ib%(11)
FOR i% = 0 TO 11: READ ia%(i%): NEXT i%
FOR i% = 0 TO 11: READ ib%(i%): NEXT i%
'INPUT PAPER SIZE, PRINTING ORIENTATION AND No OF COPIES
IF$ = " Incorrect format": IC$ = "Invalid No of copies": IO$ = "Invalid ISO size"
PRINT : PRINT "Paper size: ISO A4 to A6, B5 to B7"
PRINT "     Width: 3 inches to 8.5 inches"
PRINT "    Length: 5 inches to 14 inches plus"
PRINT "   If over 14 inches, bottom margin increases (portrate) or left margin increases (landscape)"
SIZE: PRINT : PRINT "Enter paper size (ISO or width X length), printing orientation and No of copies"
INPUT " (eg <A4,P,6>, <B5,L,1>, <8.5X11,P,2>): ", PS$, O$, NM$
IF PS$ = "" OR O$ = "" OR NM$ = "" THEN PRINT IF$: GOTO SIZE
PS$ = UCASE$(PS$): O$ = UCASE$(O$): ln% = LEN(PS$): REDIM PS$(ln%)
'STORE PAPER SIZE STRING CHARACTERS IN ARRAY
FOR i% = 1 TO ln%: PS$(i%) = MID$(PS$, i%, 1): NEXT i%
'CHECK No OF COPIES, ESTABLISH PRINTING ORIENTATION AND SET PRINTING ORIENTATION COMMAND
nc% = VAL(NM$): IF nc% < 1 THEN PRINT IC$: GOTO SIZE
IF O$ = "P" THEN POC$ = ESC$ + "&l0O" ELSE IF O$ = "L" THEN POC$ = ESC$ + "&l1O" ELSE PRINT IF$: GOTO SIZE
'ESTABLISH IF ISO SIZE
IF PS$(1) = "A" OR PS$(1) = "B" THEN
 IF (PS$(2) >= "0" AND PS$(2) <= "9") AND (MID$(PS$, 3, 1) = "0" OR (MID$(PS$, 3, 1) = "")) THEN
  in% = VAL(MID$(PS$, 2))
 ELSE
  PRINT IO$: GOTO SIZE
 END IF

'CALCULATE ISO SIZE WIDTH AND LENGTH
 IF PS$(1) = "A" THEN
  w! = ia%(in% + 1) / 25.4: l! = ia%(in%) / 25.4
 ELSEIF PS$(1) = "B" THEN
  w! = ib%(in% + 1) / 25.4: l! = ib%(in%) / 25.4
 END IF
'NOT ISO SIZE
ELSE
'FIND X BETWEEN PAPER WIDTH AND LENGTH
 h% = 0: x% = 0
 FOR i% = 2 TO ln% - 1: IF PS$(i%) = "X" THEN h% = h% + 1: x% = i%
 NEXT i%
 IF h% = 1 THEN
  PW$ = LEFT$(PS$, x% - 1): PL$ = MID$(PS$, x% + 1, ln% - x%)
 ELSE
  PRINT IF$: GOTO SIZE
 END IF

'CHECK FORMAT OF PAPER WIDTH STRING AND CALCULATE WIDTH
 h% = 0
 FOR i% = 1 TO x% - 1
  IF PS$(i%) = "." THEN
   h% = h% + 1
  ELSEIF PS$(i%) < "0" OR PS$(i%) > "9" THEN
   PRINT IF$: GOTO SIZE
  END IF
 NEXT i%
 IF h% <= 1 THEN w! = VAL(PW$) ELSE PRINT IF$: GOTO SIZE
'CHECK FORMAT OF PAPER LENGTH STRING AND CALCULATE LENGTH
 h% = 0
 FOR i% = x% + 1 TO ln% - 1
  IF PS$(i%) = "." THEN
   h% = h% + 1
  ELSEIF PS$(i%) < "0" OR PS$(i%) > "9" THEN
   PRINT IF$: GOTO SIZE
  END IF
 NEXT i%
 IF h% <= 1 THEN l! = VAL(PL$) ELSE PRINT IF$: GOTO SIZE
END IF
'ROUND PAPER SIZES TO TWO DECIMAL PLACES
c% = 100: w! = CINT(w! * c%) / c%: l! = CINT(l! * c%) / c%
IF l! > 14 THEN XL$ = STR$(CINT((l! - 14) * c%) / c%)

'SET UP STRINGS FOR PAPER SIZE CHECK
IF O$ = "P" THEN ON$ = "landscape": MN$ = "Bottom"
IF O$ = "L" THEN ON$ = "portrate": MN$ = "Left"
T1$ = "Paper too wide for printer"
T2$ = "Paper too narrow for printer"
T3$ = "Paper too short for printer"
T4$ = "Use paper 3 inches or wider"
T5$ = "Use paper 3 inches or longer"
T6$ = "Use paper 5 inches or longer"
T7$ = "Use paper 8.5 inches or narrower"
T8$ = "Use paper 3 x 5 inches or larger"
T9$ = "Retain current settings"
T10$ = "Turn paper 90 degrees, exchange width and length settings "
T11$ = "and print in " + ON$ + " orientation"
T12$ = "Cut to size after printing"
T13$ = "Note that length exceeds printer max of 14 inches"
T14$ = MN$ + " margin will increase by" + XL$ + " inches"
S1$ = "Enter A to abandon, R to re-enter paper sizes"
S2$ = ", C to continue"

'CHECK PAPER SIZE SUITABLE FOR PRINTER
IF w! > 8.5 THEN
 PRINT : PRINT T1$
 IF l! < 3 THEN
  PRINT T3$: PRINT T5$: PRINT T10$: PRINT T11$: PRINT T12$
  GOTO AORR
 ELSEIF l! <= 8.5 THEN
  PRINT T10$: PRINT T11$
  GOTO AORR
 ELSEIF l! > 8.5 THEN
  PRINT T7$
  IF l! > 14 THEN PRINT T13$: PRINT T14$
  GOTO AORR
 END IF

ELSEIF w! >= 3 THEN
 PRINT
 IF l! < 5 THEN
  PRINT T3$: PRINT T6$: PRINT T9$: PRINT T12$
  GOTO ARORC
 ELSEIF l! <= 14 THEN
  GOTO CHRS1
 ELSEIF l! > 14 THEN
  l! = 14: PRINT T13$: PRINT T14$
  GOTO ARORC
 END IF

ELSEIF w! < 3 THEN
 PRINT : PRINT T2$
 IF l! < 5 THEN
  PRINT T3$: PRINT T8$: PRINT T10$: PRINT T11$: PRINT T12$
  GOTO ARORC
 ELSEIF l! >= 5 THEN
  PRINT T4$: PRINT T9$: PRINT T12$
  IF l! > 14 THEN l! = 14: PRINT T13$: PRINT T14$
  GOTO ARORC
 END IF
END IF

'CHANGE OPTIONS
AORR: PRINT : PRINT S1$; : INPUT ": ", AR$: AR$ = UCASE$(AR$)
IF AR$ = "A" THEN GOTO FINISH ELSE IF AR$ = "R" THEN GOTO SIZE ELSE GOTO AORR
ARORC: PRINT : PRINT S1$; S2$; : INPUT ": ", AR$: AR$ = UCASE$(AR$)
IF AR$ = "A" THEN GOTO FINISH ELSE IF AR$ = "R" THEN GOTO SIZE ELSE IF AR$ = "C" THEN GOTO CHRS1 ELSE GOTO ARORC

'INPUT CHARACTERS/INCH, LINES/INCH, CHARACTER SET, FONT AND PRINT QUALITY
CHRS1: PRINT
PRINT "  |      Characters/inch: 1 to 120        ||     Font: C Courier       |"
PRINT "  |                                       ||           G Gothic        |"
PRINT "  |  Lines/inch: 1,2,3,4,6,8,12,16,24,48  ||                           |"
PRINT "  |                                       ||                           |"
PRINT "  | Character sets:                       ||                           |"
PRINT "  |  Windows extended ASCII  CP 1252:  A  ||  Print quality:           |"
PRINT "  |  Latin 1  ISO 8859/1   (ECMA-94):  L  ||  Normal                N  |"
PRINT "  |  MS-DOS   MULTILINGUAL   CP  850:  M  ||  Draft (economy mode)  D  |"
PRINT "  |  IBM-DOS & MS-DOS  PC-8  CP  437:  I  ||                           |"
PRINT "  |  UK (#>pound, No 80H>FFH)  ISO 4:  U  ||                           |"
CHRS2: PRINT : PRINT "Enter characters/inch, lines/inch, character set, font and print quality"
INPUT "(eg <10,6,A,C,N>, <12,6,M,G,D>, <16,8,I,C,N>): ", ci%, li%, CS$, F$, EM$: CS$ = UCASE$(CS$): F$ = UCASE$(F$): EM$ = UCASE$(EM$)
'CHECK CHRS/INCH VALID
IF ci% < 1 OR ci% > 120 THEN PRINT " Chrs/inch invalid": GOTO CHRS2
'CHECK LINES/INCH VALID
IF NOT (li% = 1 OR li% = 2 OR li% = 3 OR li% = 4 OR li% = 6 OR li% = 8 OR li% = 12 OR li% = 16 OR li% = 24 OR li% = 48) THEN
 PRINT : PRINT "Lines/inch invalid": GOTO CHRS2
END IF
'SET PRINTER COMMAND FOR CHARACTER SET
IF CS$ = "A" THEN
 CSC$ = ESC$ + "(19U"
ELSEIF CS$ = "L" THEN
 CSC$ = ESC$ + "(0N"
ELSEIF CS$ = "M" THEN
 CSC$ = ESC$ + "(12U"
ELSEIF CS$ = "I" THEN
 CSC$ = ESC$ + "(10U"
ELSEIF CS$ = "U" THEN
 CSC$ = ESC$ + "(1E"
ELSE
 PRINT : PRINT "Character set invalid": GOTO CHRS2
END IF
'SET PRINTER COMMAND FOR FONT
IF F$ = "C" THEN
 FC$ = ESC$ + "(s4099T"
ELSEIF F$ = "G" THEN
 FC$ = ESC$ + "(s4102T"
ELSE
 PRINT : PRINT "Font invalid": GOTO CHRS2
END IF
'SET PRINTER JOB LANGUAGE STRING FOR NORMAL OR DRAFT (ECONOMY MODE)
IF EM$ = "D" THEN
 EMC$ = "ON"
ELSEIF EM$ = "N" THEN
 EMC$ = "OFF"
ELSE PRINT : PRINT "Print quality invalid": GOTO CHRS2
END IF

'ESTABLISH MARGINS, PRINTING WIDTH AND LENGTH
rwx! = 8: rwn! = 5: rlx! = 10: rln! = 6
IF O$ = "L" THEN SWAP w!, l!: SWAP rlx!, rwx!: SWAP rln!, rwn!

'CALCULATE TOP AND BOTTOM MARGINS AND PRINTING LENGTH IN LINES
tmx! = 1: tmn! = .5: tmpa! = -.125: tmla! = 0: bmx! = .75: bmn! = .375
IF l! >= rlx! THEN
 tmi! = tmx!: bmi! = bmx!
ELSEIF l! <= rln! THEN
 tmi! = tmn!: bmi! = bmn!
ELSE
 tbr! = (l! - rln!) / (rlx! - rln!)
 tmi! = tmn! + (tmx! - tmn!) * tbr!: bmi! = bmn! + (bmx! - bmn!) * tbr!
END IF
IF O$ = "P" THEN
 tml% = tmi! * li%
 tmla% = (tmi! + tmpa!) * li%
ELSEIF O$ = "L" THEN
 tml% = tmi! * li%
 tmla% = (tmi! + tmla! + (8.5 - l!) / 2) * li%
END IF
bml% = bmi! * li%: ll% = l! * li%
lpl% = ll% - tml% - bml%
IF lpl% < 1 THEN PRINT "Print length less than 1 line": GOTO AORR

'CALCULATE LEFT AND RIGHT MARGINS AND PRINTING WIDTH IN COLUMNS
lmx! = 1: lmn! = .5: lmpa! = -.25: lmla! = -.1875: rmx! = .5: rmn! = .25
IF w! >= rwx! THEN
 lmi! = lmx!: rmi! = rmx!
ELSEIF w! <= rwn! THEN
 lmi! = lmn!: rmi! = rmn!
ELSE
 lrr! = (w! - rwn!) / (rwx! - rwn!)
 lmi! = lmn! + (lmx! - lmn!) * lrr!: rmi! = rmn! + (rmx! - rmn!) * lrr!
END IF
IF O$ = "P" THEN
 lmc% = lmi! * ci%
 lmca% = (lmi! + lmpa! + (8.5 - w!) / 2) * ci%
ELSEIF O$ = "L" THEN
 lmc% = lmi! * ci%
 lmca% = (lmi! + lmla! + 14 - w!) * ci%
END IF
rmc% = rmi! * ci%: wc% = w! * ci%
wpc% = wc% - lmc% - rmc%
IF wpc% < 1 THEN PRINT "Print width less than 1 character": GOTO AORR

'PRINTER COMMANDS
'SET PAPER SIZE MAX, LINES/INCH, TOP MARGIN LINES,
'CHRS/INCH, LEFT MARGIN COLUMNS, AND LINE TERMINATION
PSC$ = ESC$ + "&l3A": LIC$ = ESC$ + "&l" + MID$(STR$(li%), 2) + "D"
TPML$ = ESC$ + "&l" + MID$(STR$(tmla%), 2) + "E": CIC$ = ESC$ + "(s" + MID$(STR$(ci%), 2) + "H"
LTMC$ = ESC$ + "&a" + MID$(STR$(lmca%), 2) + "L": LNT$ = ESC$ + "&k0G"
'SET QBASIC LPRINT WIDTH TO INFINATE
WIDTH LPRINT 255
'SEND ECONOMY MODE PRINTER JOB CONTROL COMMAND TO PRINTER
UEL$ = ESC$ + "%-12345X": PJL$ = "@PJL"
LPRINT UEL$ + PJL$
LPRINT PJL$ + " SET ECONOMODE = " + EMC$
'SEND PRINTER COMMANDS TO PRINTER
LPRINT RST$; PSC$; POC$; LIC$; TPML$; CIC$; LTMC$; CSC$; FC$; LNT$;

'SET UP UNDERLINE, ITALIC AND BOLD ESCAPE SEQUENCES ARRAY
FOR i% = 0 TO 9: READ ESQ$(i%): NEXT i%

'SET UP END OF LINE DELIMITER ARRAY
DIM D$(33)
FOR i% = 1 TO 33
 READ dl%: D$(i%) = CHR$(dl%)
NEXT i%
IF CH$ = "L" OR CH$ = "M" OR CH$ = "I" OR CH$ = "U" THEN
 FOR i% = 4 TO 6: D$(i%) = "": NEXT i%
 FOR i% = 22 TO 27: D$(i%) = "": NEXT i%
END IF
IF CH$ = "M" OR CH$ = "I" THEN
 D$(7) = CHR$(&HAE): D$(28) = CHR$(&HFF): D$(29) = CHR$(&HAD): D$(30) = CHR$(&HDD)
 D$(31) = CHR$(&HF0): D$(32) = CHR$(&HAF): D$(33) = CHR$(&HA8)
END IF
IF CH$ = "I" THEN
 D$(30) = "": D$(31) = ""
END IF
IF CH$ = "U" THEN
 FOR i% = 28 TO 33: D$(i%) = "": NEXT i%
END IF

'INPUT TEXT, FIND FORM FEEDS,AND UNDERLINE, ITALIC AND BOLD ESCAPE SEQUENCES
DO WHILE nc% > 0
 OPEN FS$ FOR INPUT AS #1: lno% = 0
 DO WHILE NOT EOF(1)
  LINE INPUT #1, FL$: lfl% = LEN(FL$): tf% = 0
  DO
'CHECK FOR LEADING AND TRAILING FORM FEEDS
   IF LEFT$(FL$, 1) = FF$ THEN
    IF lno% > 0 THEN LPRINT FF$; : lno% = 0
    FL$ = MID$(FL$, 2): lfl% = lfl% - 1
   END IF
   IF RIGHT$(FL$, 1) = FF$ THEN
    lfl% = lfl% - 1: FL$ = LEFT$(FL$, lfl%): tf% = 1
   END IF

'CHECK FOR ESCAPE SEQUENCES
   wpe% = wpc%: wph% = wpc% \ 2: adl% = 0: i% = 0
   DO
    i% = i% + 1
    IF MID$(FL$, i%, 1) = ESC$ THEN
     ad% = 0
     ESQ$ = MID$(FL$, i% + 1, 4)
     FOR j% = 1 TO 9
      IF ESQ$ = ESQ$(j%) THEN ad% = 5: EXIT FOR
     NEXT j%
     IF ad% = 0 AND LEFT$(ESQ$, 3) = ESQ$(0) THEN ad% = 4
     IF ad% <> 0 THEN
      wpe% = wpe% + ad%: adl% = adl% + ad%
      IF i% <= wph% THEN wph% = wph% + ad%
     ELSE
      PRINT : PRINT "The program has encountered an escape sequence other than underline, italic or bold"
     END IF
    END IF
   LOOP UNTIL i% = wpe% OR i% = lfl% + adl%

'CHECK FOR SHORT LINE
   IF lfl% <= wpe% THEN
    IF lfl% = 0 AND lno% = 0 THEN EXIT DO
    LP$ = FL$: FL$ = "": GOTO LPRNT
   END IF

'FIND LINE BREAKS AND PRINT
'CHECK FOR SPACE
   FOR i% = wpe% + 1 TO wph% STEP -1
    SA$ = MID$(FL$, i%, 1)
    IF SA$ = " " THEN
     LP$ = LEFT$(FL$, i% - 1): FL$ = MID$(FL$, i% + 1): GOTO LPRNT
    END IF
   NEXT i%
'CHECK FOR RIGHT FACING BRACKETS
   FOR i% = wpe% + 1 TO wph% STEP -1
    SA$ = MID$(FL$, i%, 1): SB$ = MID$(FL$, i% - 1, 1)
    FOR j% = 1 TO 7
     IF SA$ = D$(j%) AND SB$ <> ESC$ THEN
      LP$ = LEFT$(FL$, i% - 1): FL$ = MID$(FL$, i%): GOTO LPRNT
     END IF
    NEXT j%
'CHECK FOR LEFT FACING BRACKETS AND PUNCTUATION
    FOR j% = 8 TO 33
     IF SB$ = D$(j%) THEN
      LP$ = LEFT$(FL$, i%): FL$ = MID$(FL$, i% + 1): GOTO LPRNT
     END IF
    NEXT j%
   NEXT i%
'NO SUITABLE LINE BREAK FOUND
   LP$ = LEFT$(FL$, wpe%): FL$ = MID$(FL$, wpe% + 1)
LPRNT: LPRINT LP$; : lno% = lno% + 1: lfl% = LEN(FL$)
   IF lno% < lpl% AND tf% = 0 THEN LPRINT  ELSE LPRINT CR$ + FF$; : lno% = 0
  LOOP WHILE lfl% > 0
 LOOP
 IF lno% > 0 THEN LPRINT CR$ + FF$;
 CLOSE #1
 nc% = nc% - 1
LOOP
LPRINT RST$;
FINISH: END

'ARRAY DATA
'ISO SIZE DIMENSIONS
DATA 1189,841,594,420,297,210,148,105,74,52,37,26
DATA 1414,1000,707,500,353,250,176,125,88,62,44,31

'HP PCL UNDERLINE, ITALIC AND BOLD ESCAPE SEQUENCES
DATA "&d@","&d0D","&d1D","&d2D","&d3D","&d4D","(s1S","(s0S","(s3B","(s0B"

'END OF LINE DELIMITERS
DATA &H28,&H5B,&H7B,&H8B,&H91,&H93,&HAB,&H21,&H29,&H2C,&H2D
DATA &H2E,&H2F,&H3A,&H3B,&H3F,&H5C,&H5D,&H5F,&H7C,&H7D,&H85
DATA &H92,&H94,&H96,&H97,&H9B,&HA0,&HA1,&HA6,&HAD,&HBB,&HBF

'THIS PROGRAM WILL PRINT TEXT FILES ON ANY SIZE OF PAPER
'AND IN ANY SIZE OF ANY OF THE INTERNAL FIXED PITCH FONTS
'WITHIN THE CAPABILITY OF THE HP LASERJET 6L PRINTER

******************************************************************************

VARIABLE LIST

INTEGER VARIABLES
ad%    No of characters in escape sequence
adl%   Total No of characters in escape sequences
bml%   Bottom margin lines
c%     100 for rounding to 2 decimal places
ci%    Characters/inch
dl%    ASCII values of delimiters other than space
h%     Counter for paper size strings
i%     First counter
ia%()  Array for ISO A sizes
ib%()  Array for ISO B sizes
in%    ISO size A or B Number
j%     Second counter
lfl%   Lenth of file line columns
li%    Lines/inch
ll%    Length of paper line columns
lmc%   Left margin columns
lmca%  Left margin columns adjusted
ln%    Length of paper size string
lno%   Line No on page
lpl%   Length for printing lines
nc%    Number of copies
rmc%   Right margin columns
tf%    Marker for trailing form feed
tml%   Top margin lines
tmla%  Top margin lines adjusted
wc%    Width of paper columns
wpc%   Width for printing columns
wpe%   As wpe% but allowing for escape sequences
wph%   Lower limit for line break search (=wpc%\2)
x%     Array subscript No for "X" in paper size string

SINGLE PRECISION FLOATING POINT VARIABLES
bmi!   Bottom margin inches
bmn!   Bottom margin minimum inches
bmx!   Bottom margin maximum inches
l!     Paper length inches
lmi!   Left margin inches
lmla!  Left margin landscape adjuster inches
lmn!   Left margin minimum inches
lmpa!  Left margin portrate adjuster inches
lmx!   Left margin maximum inches
lrr!   Left and right margins ratio
rln!   Reference length minimum inches
rlx!   Reference lingth maximum inches
rmi!   Right margin inches
rmn!   Right margin minimum inches
rmx!   Right margin maximum inches
rwn!   Reference width minimum inches
rwx!   Reference width maximum inches
tbr!   Top and bottom margins ratio
tmi!   Top margin inches
tmla!  Top margin landscape adjuster inches
tmn!   Top margin mimimum inches
tmpa!  Top margin portrate adjuster inches
tmx!   Top margin maximum inches
w!     Paper width inches

STRING VARIABLES
AR$    Input string for abandon re-enter or continue
CIC$   Characters/inch printer command
CR$    Carriage return ^M
CSC$   Character set printer command
CS$    Character set string
D$()   Array for delimeters other than spsce
EM$    String print quality "D" or "N"
EMC$   String for economy mode "ON" or "OFF"
ESC$   Escape code ^[
ESQ$   Escape sequencws
ESQ$() Array for underline, italic and bold escape sequences
F$     String for font "C" (courier) "G" (gothic)
FC$    String for font command
FF$    Form feed code ^L
FL$    File line string
FS$    Filespec string
IC$    String "Invalid number of copies"
IF$    String "Incorrect format"
IO$    String "Invalid ISO size"
LIC$   Lines/inch printer command
LNT$   Line termination printer command
LP$    Line for printing
LTMC$  Left margin printer command
MN$    String for "Bottom" or "Left"
NM$    String for entering No of copies
O$     Printing orientation
ON$    String for "portrate" or "landscape"
PJL$   String for PJL economy mode command
PL$    Paper length string
POC$   Printing orientation printer command
PS$    Paper size string
PS$()  Array for paper size string characters
PSC$   Paper size printer command
PW$    Paper width string
RST$   Printer reset command
S1$    String "Enter A to Abandon R to re-enter . . . ."
S2$    String " C to continue"
SA$    Character being checked for line break
SB$    Character to the right of SA$
T1$    String "Paper too wide for printer"
T10$   String "Turn paper 90 degrees exchange width and . . ."
T11$   String "and print in " + ON$ + " orientation"
T12$   String "Cut to size after printing"
T13$   String "Note that length exceeds printer max of 14 . . ."
T14$   String MN$ + " margin will increase by" + XL$ + " inches"
T2$    String "Paper too narrow for printer"
T3$    String "Paper too short for printer"
T4$    String "Use paper 3 inches or wider"
T5$    String "Use paper 3 inches or longer"
T6$    String "Use paper 5 inches or longer"
T7$    String "Use paper 8.5 inches or narrower"
T8$    String "Use paper 3 x 5 inches or larger"
T9$    String "Retain current settings"
TPML$  Top margin printer command
UEL$   String for PJL economy mode command
XL$    String for increase in margin if over 14 inches

******************************************************************************

 
 Respond to this message   

(Login slowneutron)

*Thanks for the help

May 4 2012, 8:51 AM 


 
 Respond to this message   

(Login MCalkins)
R

Yeah...

May 4 2012, 9:26 AM 

I just realized you had posted it with NBSPs the first time...

I don't think there is any way to control the font in this subforum. You'd just have to expect people to copy it to notepad, or something, to see the correct alignment.

Regards,
Michael

 
 Respond to this message   
Current Topic - HP LaserJet Print Program
  << Previous Topic | Next Topic >>Return to Index  

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums