Using PUT for printer control
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Using PUT for printer control
When you send output to a printer, you may want to modify the way the printer generates that output. Many printers have a set of control sequences you can use to specify different print characteristics. You might, for example, want to change the number of printed characters per inch.
When you write a procedure that sends output to a printer, you can include printer control sequences within that procedure. Many control sequences involve special characters that can be represented by their octal (base 8) equivalent. To distinguish these octal codes, you precede the three octal digits by an escape character. the AVM then converts the octal number to a single character.
On UNIX, the escape character is a tilde (~) or a backslash (\).
The PUT statement with the CONTROL option
allows you to specify a control sequence to send to the printer.
This is a partial syntax for this version of the PUT statement:
Syntax
|
The control sequences you send to the printer have no effect on the current line, page counters, and positions maintained within ABL. Assume you want to print a report on your Brand X printer, using compressed-print mode.
The i-10-13.p procedure implements this task.
i-10-13.p
|
These notes help to explain the code:
- The start-compress variable contains the four-character sequence that puts the printer into compressed-print mode. These four characters are octal 033 (decimal 27) followed by left bracket ([), 3, and w.
- The variable stop-compress takes the printer out of compressed print mode.
- When the user clicks
b-normal, the AVM runs the report in normal mode. - When the user clicks
b-compressed, the AVM runs the report in compressed mode.
Control sequences are hardware-dependent, thus applications containing hard-coded
printer control sequences are not easily portable to other environments.
See Manage ABL Applications for more
information about using the PUT CONTROL statement
with control sequences.