Re: Printer Control Codes and Reports
Posted in 1993
->From: wood@genesis.MCS.COM (Greg Woodard)
->Subject: Printer Control Codes and Reports
->Date: 14 Oct 1993 10:32:38 -0500
->Reply-To: wood@genesis.MCS.COM (Greg Woodard)
->Organization: MCSNet Subscriber, Chicago, IL
->
->I am trying to print 4GL reports to an HP laserjet III printer hooked up to a
->Sun Sparc IPX. I have problems getting the printer to print landscape, legal
->documents. Is there any way to imbed printer control codes for a printer into
->a 4GL report??? Informix mentioned using a C external or program. Has anyone
->written such code or fought this problem???
->
->Thanks in advance.
->-------------------------------------------------------------
->Greg Woodard (wood@genesis.mcs.com)
Greg,
The info in the attached archive appears to do what you want, and more.
This is, of course, only one of many ways to solve your problem. The
info comes from the software library of the Informix Users Group of
Colorado; I do not remember the name of the contributor.
Because pdef.uld contains escape and other control codes which may foul
the mail net, I have uuencoded it. For netters not familiar with ar and
uudecode, use the following steps to extract the three files:
1. Copy the bottom of this mail, starting with the '!<arch>' line to
file 'pdef.ar' in some work directory.
2. ar xv pdef.ar
3. uudecode pdef.uld.uue
You should now have files pdef.sch, pdef.uld, and testpdef.4gl, along
with pdef.ar and pdef.uld.uue, which can be deleted.
Regards,
Alan ___________________________
______________________| R. Alan Popiel |__________________________
\\ Internet: | Martin Marietta, Tech Ops | /
\\ alan@den.mmc.com | P.O. Box 179, M/S 5422 | Std disclaimers apply. /
)Voice: | Denver, CO 80201-0179 USA | (
/ 303-977-9998 |___________________________| (But you knew that!) \\
/________________________) (____________________________\\
O /
===============================X---------------------------------------------
O \\
!<arch>
pdef.sch 705598144 10107 10000 100644 472 `
create table printer_def
(
p_id serial not null,
p_name char(25),
p_type char(10),
p_dest char(10),
p_reset char(20),
p_special_a char(20),
p_special_b char(20),
p_special_c char(20),
p_bold char(20),
p_bold_off char(20),
p_uline char(20),
p_uline_off char(20),
p_compr char(20),
p_compr_off char(20),
p_landscape char(20),
p_landscape_off char(20)
);
create unique index ix149_1 on printer_def (p_id);pdef.uld.uue 750696605 10107 10000 100644 737 `
begin 644 pdef.uld
M,'Q(4"!,05-%4B!04DE.5$52+4E)('Q,05-%4GQH<%\\R?!M%?'Q\\?!LH<S-"
M?!LH<S!"?!LF9$1\\&R9D0'P;)FLR4WP;)FLP4WP;)FPQ3WP;)FPP3WP*,'Q(
M4"!,05-%4B!04DE.5$52+4E)27Q,05-%4GQH<%\\S?!M%?'Q\\?!LH<S-"?!LH
M<S!"?!LF9#!$?!LF9$!\\&R9K,E-\\&R9K,%-\\&R9L,4]\\&R9L,$]\\"C!\\3TM)
M1$%402!,05-%4B!04DE.5$52?$Q!4T52?&]K:5\\R?!M%?'Q\\?!LH<S-"?!LH
M<S!"?!LF9$1\\&R9D0'P;:S)3?!MK,%-\\&R9L,4]\\&R9L,$]\\"C!\\3TM)1$%4
M02!,05-%4B!04DE.5$52?$Q!4T52?&]K:5\\Q?!M%?'Q\\?!LH<S-"?!LH<S!"
M?!LF9$1\\&R9D0'P;:S)3?!MK,%-\\&R9L,4]\\&R9L,$]\\"C!\\0T%.3TX@3$%3
M15(@4%))3E1%4GQ,05-%4GQC86YO;C%\\&V-\\&UM\\&SM\\?!M;,6U\\&ULR,FU\\
M&ULT;7P;6S(T;7P;6S(@2WP;6S @2WP;6S$E<GP;6S E<GP*,'Q004X@2U@M
M4#$Q,C1I+45P<V]N($Q1.#4P?$U!5%))6'QP86YA<V]N:6-\\&T!\\?'Q\\&T=\\
4&TA\\&RTQ?!LM,'P;#WP;0'Q\\? I!
end
testpdef.4gl 705598191 10107 10000 100644 2168 `
# This program demonstrates the ability to send control codes to the printer
# via a 4GL report. The control codes are stored in a printer definition
# table and are selected for the report based on printer destination.
#
# Arguments to program: <printer destination>
#
# Example Usage: fglgo testprint hp_1
#
database legal
globals
define p record like printer_def.*
define arg1 char(15)
define answer char(1)
define comm char(80)
end globals
main
options
prompt line 24
let arg1 = arg_val(1)
if (arg1 is null or arg1 == " ") then
error ""
display "Usage: fglgo testprint 'printer destination'" at 2,1
display " Example: fglgo testprint hp_1" at 4,1
prompt "Press the space bar to exit." for char answer
exit program
end if
initialize p.* to null
select * into p.* from printer_def
where printer_def.p_dest = arg1
if ( p.p_id is null ) then
error ""
display "Printer definition not found for '", arg1 clipped, "'" at 2,1
prompt "Press the space bar to exit." for char answer
exit program
end if
start report testprintrpt to "testprint.out"
output to report testprintrpt()
finish report testprintrpt
display "Output file saved in testprint.out" at 2,1
prompt "Do you want to send this file to printer '", arg1 clipped,
"'? " for char answer
let answer = upshift(answer)
if ( answer == "Y" ) then
let comm = "lp -d ", arg1 clipped, " testprint.out"
run comm
end if
end main
report testprintrpt()
format
on every row
print p.p_dest
print p.p_reset
print p.p_special_a
print p.p_special_b
print p.p_special_c
print p.p_bold
print "This line should be BOLD"
print p.p_bold_off
print "This line should NOT be BOLD"
print p.p_uline
print "This line should be underlined"
print p.p_uline_off
print "This line should NOT be underlined"
print p.p_compr
print "This line should be compressed"
print p.p_compr_off
print "This line should NOT be compressed"
print p.p_landscape
print "Landscape is on"
print p.p_landscape_off
print "Landscape is off"
end report