Difference between revisions of "Printing"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(One intermediate revision by one user not shown) | |||
Line 13: | Line 13: | ||
print <filename> | print <filename> | ||
</code> | </code> | ||
+ | |||
To redirect output to a system printer, the command [SET PRINTER|SET PRINTER TO \\SPOOLER]] is used. This picks up the environment variable DB_PRINT (set in the system-wide [[Configuration Files|configuration file]]). The value of DB_PRINT must be either a valid Operating System print command, e.g. on UNIX: | To redirect output to a system printer, the command [SET PRINTER|SET PRINTER TO \\SPOOLER]] is used. This picks up the environment variable DB_PRINT (set in the system-wide [[Configuration Files|configuration file]]). The value of DB_PRINT must be either a valid Operating System print command, e.g. on UNIX: | ||
Line 20: | Line 21: | ||
DB_PRINT="lp -dmyprinter -onobanner" | DB_PRINT="lp -dmyprinter -onobanner" | ||
</pre> | </pre> | ||
+ | |||
or the name of a file which contains such a command (and any other processing required.) By default, DB_PRINT is set to the file ’print.<os>’ in the Recital home ''bin'' sub-directory. This can be modified if required, to suit your particular printing environment. The ’print.<os>’ file contains a further environment variable, called DB_PRINTOPT, which can be set to the options that you require on the OS print command. By default, the value of DB_PRINTOPT is set in the system-wide [[Configuration Files|configuration file]], but the [[PUTENV()]] function can be used to change this value, and the [[GETENV()]] function to query it. The following commands will cause an environment status listing to be printed according to the command(s) specified by DB_PRINT: | or the name of a file which contains such a command (and any other processing required.) By default, DB_PRINT is set to the file ’print.<os>’ in the Recital home ''bin'' sub-directory. This can be modified if required, to suit your particular printing environment. The ’print.<os>’ file contains a further environment variable, called DB_PRINTOPT, which can be set to the options that you require on the OS print command. By default, the value of DB_PRINTOPT is set in the system-wide [[Configuration Files|configuration file]], but the [[PUTENV()]] function can be used to change this value, and the [[GETENV()]] function to query it. The following commands will cause an environment status listing to be printed according to the command(s) specified by DB_PRINT: | ||
Line 29: | Line 31: | ||
set printer to | set printer to | ||
</code> | </code> | ||
+ | |||
The following will send output to the system printer (and the screen): | The following will send output to the system printer (and the screen): | ||
Line 51: | Line 54: | ||
set device to print | set device to print | ||
</code> | </code> | ||
+ | |||
And to return control to the screen: | And to return control to the screen: | ||
Line 114: | Line 118: | ||
set screenmap on | set screenmap on | ||
</code> | </code> | ||
+ | |||
Control sequences sent must be appropriate to your printer. | Control sequences sent must be appropriate to your printer. | ||
Line 119: | Line 124: | ||
==PRINTSCREEN()== | ==PRINTSCREEN()== | ||
− | The [[PRINTSCREEN()]] function can be used to dump a copy of the current screen to a file or to | + | The [[PRINTSCREEN()]] function can be used to dump a copy of the current screen to a file or to a system printer (not slave). The function is most often called from within a hot key procedure to enable screen dumps of full screen forms, e.g. |
Line 133: | Line 138: | ||
on key label tab do pscreen | on key label tab do pscreen | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Reference]] | [[Category:Reference]] |
Latest revision as of 15:34, 19 December 2014
The printing commands within the Recital/4GL allow you to send output to a system printer, to a file or to a local printer attached to the printer port of your terminal.
Contents
See Also
?, ??, ???, @...SAY, Configuration Files, DB_PRINTEREJECT, DB_PRINTERROR, EJECT, GETENV(), PCOL(), PRINT, PRINTFILE(), PRINTSCREEN(), PROW(), PUTENV(), SET CONSOLE, SET DEVICE, SET MAPCHAR, SET PRINT, SET PRINTER, SET SCREENMAP, SETPRC(), SYS(), Terminal Definition Files
Printing to a System Printer
When you have a default printer destination set on your system, the following command will send the specified file to that printer:
print <filename>
To redirect output to a system printer, the command [SET PRINTER|SET PRINTER TO \\SPOOLER]] is used. This picks up the environment variable DB_PRINT (set in the system-wide configuration file). The value of DB_PRINT must be either a valid Operating System print command, e.g. on UNIX:
DB_PRINT="lp -dmyprinter -onobanner"
or the name of a file which contains such a command (and any other processing required.) By default, DB_PRINT is set to the file ’print.<os>’ in the Recital home bin sub-directory. This can be modified if required, to suit your particular printing environment. The ’print.<os>’ file contains a further environment variable, called DB_PRINTOPT, which can be set to the options that you require on the OS print command. By default, the value of DB_PRINTOPT is set in the system-wide configuration file, but the PUTENV() function can be used to change this value, and the GETENV() function to query it. The following commands will cause an environment status listing to be printed according to the command(s) specified by DB_PRINT:
set printer to spooler list status to print set printer to
The following will send output to the system printer (and the screen):
set printer to spooler set print on && ...output set print off set printer to
Stopping Output to the Screen
To send output solely to the specified printer, and not to the screen, the following commands are required:
set screenmap off set console off set device to print
And to return control to the screen:
set device to screen set console on set screenmap on
Printing to a File
For printing to a file, the same commands apply, but you should specify the filename in the SET PRINTER command:
set printer to myfile.txt list memory to print set printer to
Printing to a Slave Printer
If you have a printer attached to the printer port of your terminal or PC, the SET PRINTER command is not required. Use the SET PRINT command to redirect output to the printer. To prevent output also being sent to the screen, use the commands as listed above. To switch your terminal output to screen / printer or printer only mode, the control sequences specified in entries 4, 5 and 6 of the Terminal Definition File are used.
// Program to send display to local printer set screenmap off set console off set device to print set print on @1,1 say [hello world!] set print off set device to screen set console on set screenmap on
Sending Control Sequences
Control sequences can be sent to your printer using the ? or ?? commands. The command SET SCREENMAP OFF must be issued before sending the sequences to prevent them being re-mapped, e.g.
// Program sending control sequences and text to a file set printer to myfile.txt set screenmap off set console off set print on // Switch into ’emphasis mode’ ? CHR(27) + "E" ?? [HELLO] // Switch out of ’emphasis mode’ ? CHR(27) + "F" ? ? [HELLO AGAIN] set printer to set print off set console on set screenmap on
Control sequences sent must be appropriate to your printer.
PRINTSCREEN()
The PRINTSCREEN() function can be used to dump a copy of the current screen to a file or to a system printer (not slave). The function is most often called from within a hot key procedure to enable screen dumps of full screen forms, e.g.
// Hot key procedure procedure pscreen set printer to spooler printscreen() set printer to return // Current screen is sent to system printer when [TAB] key is pressed on key label tab do pscreen