BBS: Inland Empire Archive Date: 02-15-93 (06:51) Number: 334 From: TOM HAMMOND Refer#: NONE To: ERIC REIDMILLER Recvd: NO Subj: Lprint Conf: (2) Quik_Bas
ER>i am trying to write a program in quickbasic for my printer to print in the spaces provided by my expense reports except that using "LPRINT" doesn't always match-up. is there a small increment than "LPRINT" ? ER>using "TAB(x)" works fine for left and right spacing but i can't get the lines to match. One of the BIG problems in doing what (I think) you're attempting to do is to get the darned thing to 'fit' that which it it does well (print) into the lines on a pre-printed form. Mainly because the form designers often seldom planned for the form to be machine-printed... it's not too difficult to mkae your fist print in a non-uniformly spaced series of lines, etc., or even to periodically re-align the platen on your typewriter. First off, LPRINT per se is NOT the culprit. It's the linefeed increment on your printer! The printer is defaulted to a 1/6" linefeed increment, which it will attempt to maintain until you instruct it to use a different increment. Now, here's the kicker. It's (usually) not too difficult to (temporarily) change the linefeed increment of your printer thru programming. IF you have an "IBM-compatible" printer, you should be able to switch from 6 lines per inch (LPI) linefeed incrementing to 8 LPI be merely issuing the command LPRINT CHR$(27); CHR$(48); This sends an "Esc0" to the printer and tells it to switch from 6 to 8 LPI and to continue on from there until told to change again or until turned off or othewise reset. The semicolon at the end of the LPRINT command keeps the printer from issuing an unwanted linefeed when it receives the command. To return to 6 LPI, issue the command: LPRINT CHR$(27); CHR$(50); (sends "Esc2") Now, assuming you don't want 8 LPI, but some other increment, you'll have to consult your printer manual for the exact code, because there are a jillion (conservatively) different linefeed increments available out there for each manufacturer's products and there are also several differing methods of issuing the commands from within the program. Fortunately, many of the vendors are beginning to slow down a bit on going it alone and more recently, they seem to be converginf on a more or less "semi-standard" command syntax. Here's what I have to do for my EPSON LQ-850 to get linefeed increments other than 6 LPI and 8 LPI. The LQ-850 has two Variable linespacing increments (n/60" and n/180"). PROBLEM: Calculate and set the required linespacing for 12 LPI using n/60" spacing increments. ^^^^ The LPRINT command is LPRINT CHR$(27); CHR$(65); CHR$(nn) LPI = 12 x = 60/LPI (therefore: n = 60/12 = 5) LPRINT CHR$(27; CHR$(65); CHR$(x); This sets my linespacing increment to 5/60" (or 12 LPI) using the n/60" increment availablt to my printer. PROBLEM: Calculate and set the required linespacing for 16 LPI using n/180" spacing increments. ^^^^^ The LPRINT command is LPRINT CHR$(27); CHR$(51); CHR$(nn) LPI = 16 x = 180/LPI (therefore: n = 180/16 = 11.25) LPRINT CHR$(27; CHR$(51); CHR$(x); This sets my linespacing increment to 11.25/180" (or 16 LPI) using the n/180" increment availablt to my printer. You want to change your linefeed increment on the line BEFORE you make your first linefeed at that spacing so it is in effect at the time of the linefeed, so just issue the command(s) anywhere on the previous line (start or end of line if usually OK. I usually use the end, but either works.) Remember that mant printers implement variable in a slightly different manner (different CHR$( ) character following the CHR$(27) or different increments). So you will have to work out your own set of commands, but this should at least get you pointed in the right direction. Good luck. Tom Hammond --- * Origin: Night Shift BBS (314)635-7588 HST 14.4 (1:289/15)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET