Controlling CPI on a Line Printer using ESQL/C
Posted in 2005
Poster wanted users of a 4GL/ESQL-C spooler to choose characters-per-inch (font size) when releasing already-generated spool files to line printers (laser printers were handled via a2ps). Suggestions: handle it in the Unix printer interface/script rather than embedding escape codes, e.g. lp -o cpi=10/17 — but that only worked on one of three printers. Others advised looking up each printer's control codes (PCL for lasers) and fixing the printer interface script, or wrapping lp in a shell script that echoes the CPI escape sequence ahead of the file. No confirmation from the poster that any of this worked.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
Hi everyone, Is there a way to control/change the CPI on a line printer? Say in my spooler program the user decides to use 10cpi for one report and 15cpi for another and releases them to the line printer. INFORMIX-4GL Version 7.30.HC4P1, INFORMIX-ESQL Version 9.40.UC2, HP-UX alpha B.11.00 U 9000/800. Again big thanks in advance
janderson_ph@blackskull.org wrote: > Hi everyone, > > Is there a way to control/change the CPI on a line printer? Say in my > spooler program the user decides to use 10cpi for one report and 15cpi > for another and releases them to the line printer. > > INFORMIX-4GL Version 7.30.HC4P1, INFORMIX-ESQL Version 9.40.UC2, HP-UX > alpha B.11.00 U 9000/800. Again big thanks in advance > This is best done within printer interface programs, so your application does not have embedded escape codes which are different for various types of printer. If you send output to pipe 'ls -o cpi=10' or 'lp -o cpi=17' (as an example - talk to your Unix Admin) the font will change. HTH Michael
I'm sorry I didn't paint the whole picture. The spool files have already been generated and we have a spooler program which lists all reports and user can choose there which reports to release and to which printer it should be released. The user can also change the orientation, # of copies, papersize, page range and fontsize but we only support fontsize in laser printers (we print reports via a2ps when released to a laser printer, otherwise we use lp). Now the users wants us to support fontsize on line printers as well. I have tried what you suggested but the problem is it doesn't work on all our lines printers (only 1 out of 3 responds properly to -ocpi). Is there any other way to do this? Like in c or perhaps an app like a2ps w/c supports line printers?
janderson_ph@blackskull.org schrieb: > I'm sorry I didn't paint the whole picture. The spool files have > already been generated and we have a spooler program which lists all > reports and user can choose there which reports to release and to which > printer it should be released. The user can also change the > orientation, # of copies, papersize, page range and fontsize but we > only support fontsize in laser printers (we print reports via a2ps when > released to a laser printer, otherwise we use lp). Now the users wants > us to support fontsize on line printers as well. I have tried what you > suggested but the problem is it doesn't work on all our lines printers > (only 1 out of 3 responds properly to -ocpi). Is there any other way to > do this? Like in c or perhaps an app like a2ps w/c supports line > printers? > If you need to support LaserPrinters you might want to have a look at the PCL-Codes introduced by HP and used in all modern laser printers. http://en.wikipedia.org/wiki/Printer_Control_Language -- Roland Wintgen (Systemadministrator) EVG Elektro-Vertriebs-Gesellschaft Martens GmbH & Co KG Trompeterallee 244-246, D-41189 Moenchengladbach Tel. +49 21 66 / 55 08 23, Fax +49 21 66 / 55 08 90 www.evg.de rw@evg.de
janderson_ph@blackskull.org wrote: > I'm sorry I didn't paint the whole picture. The spool files have > already been generated and we have a spooler program which lists all > reports and user can choose there which reports to release and to which > printer it should be released. The user can also change the > orientation, # of copies, papersize, page range and fontsize but we > only support fontsize in laser printers (we print reports via a2ps when > released to a laser printer, otherwise we use lp). Now the users wants > us to support fontsize on line printers as well. I have tried what you > suggested but the problem is it doesn't work on all our lines printers > (only 1 out of 3 responds properly to -ocpi). Is there any other way to > do this? Like in c or perhaps an app like a2ps w/c supports line > printers? > In most cases this can be fixed in Unix. Either get your sysadmin to fix the script that drives the printer to send 'proper' control codes OR use a script that will do that. A combination of 'echo' and 'cat' should do! HTH Michael
Roland Wintgen wrote: > janderson_ph@blackskull.org schrieb: >> I'm sorry I didn't paint the whole picture. The spool files have >> already been generated and we have a spooler program which lists all >> reports and user can choose there which reports to release and to which >> printer it should be released. The user can also change the >> orientation, # of copies, papersize, page range and fontsize but we >> only support fontsize in laser printers (we print reports via a2ps when >> released to a laser printer, otherwise we use lp). Now the users wants >> us to support fontsize on line printers as well. I have tried what you >> suggested but the problem is it doesn't work on all our lines printers >> (only 1 out of 3 responds properly to -ocpi). Is there any other way to >> do this? Like in c or perhaps an app like a2ps w/c supports line >> printers? >> > > If you need to support LaserPrinters you might want to have a look at the > PCL-Codes introduced by HP and used in all modern laser printers. > > http://en.wikipedia.org/wiki/Printer_Control_Language > Well, I'd suggest that you need to find out the escape sequences for the printer, and write a simple shell wrapper which prepends these to the file before calling lp. Something like: #!/bin/sh FILE=$1 CPI=$2 CPI_INTRO="ESC[22" #Note this is an arbitrary string - you'll need the code for your printer here CPI_EXIT=j # And here! echo ${CPI_INTRO}${CPI}${CPI_EXIT} > /tmp/print.$$ cat /tmp/print.$$ >> /tmp/print.$$ lp /tmp/print.$$ exit 0 This is a rudimentary script (as you can see), but should work. If the spool files contain printer reset codes, its a _little_ harder (not much - use sed to replace them with the reset code + the CPI sequence). HTH Graham Nicholls -- The answer's always "Yes". Now, what was the question? ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Related threads
- Compiling dbschema
- [GERMAN] 4GL-Trainingsanbieter gesucht
- RE: Performance Monitoring/Tuning
- IF and SELECT statement newbie question
- Re: PDO Informix