Re: Controlling laser printer using 4GL
Posted in 1994
->From: wtoh@solomon.technet.sg (Oh Wee Tong) ->Subject: Controlling laser printer using 4GL ->Date: 14 Jun 1994 04:14:04 GMT ->Reply-To: wtoh@solomon.technet.sg (Oh Wee Tong) ->Organization: Technet, Singapore -> ->Hello out there -> ->I want to control the printout from a laser printer by using the fonts ->provided by the printer vendor but I do not know where to start. Is this ->possible? Which are the HP laser printers that I can use? -> ->hanks and have a nice day -> ->Wee Tong -><wtoh@solomon.technet.sg> Yes, what you want is possible, and you can control any printer for which you know the control code sequences. When using the 4GL report writer, you can output control codes for fonts, etc., by using a PRINT statement. However, the 4GL compiler will not let you print certain control codes as constants, since it recognizes that they are special, and it calls them "unprintable" or "non-printing" characters (I forget the exact wording of the error message). The trick is to do the following: DEFINE code_on CHAR(3), code_off CHAR(3) LET code_on = ASCII 27, "W", ASCII 1 { example Epson print codes } LET code_off = ASCII 27, "W", ASCII 0 PRINT code_on, rest_of_data, code_off Once the control codes are hidden inside the variables, the compiler doesn't know they are special, the printer accepts the codes, and prints as dictated. There is, however, one drawback to this approach: The report writer will treat the non-printing characters as if they printed, for the purpose of counting column positions. Thus it might be difficult to get columns in your report to line up the way you want. I also have some sample code, taken from our user group library, that can show you one way of storing printer control code definitions in your database. It also includes some code information for HP and Canon laser printers. It's too big to post here, plus I need to uuencode the data which contains control codes. However, e-mail to me directly if you would me to send you this information. Regards, Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, SLS | / \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\