Difference between revisions of "Printing"

From Recital Documentation Wiki
Jump to: navigation, search
Line 8: Line 8:
 
==Printing to a System Printer==
 
==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:
 
When you have a default printer destination set on your system, the following command will send the specified file to that printer:
 +
  
 
<code lang="recital">
 
<code lang="recital">
Line 14: Line 15:
  
 
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:
 +
  
 
<pre>
 
<pre>
Line 20: Line 22:
  
 
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:
 +
  
 
<code lang="recital">
 
<code lang="recital">
Line 28: Line 31:
  
 
The following will send output to the system printer (and the screen):
 
The following will send output to the system printer (and the screen):
 +
  
 
<code lang="recital">
 
<code lang="recital">
Line 40: Line 44:
 
==Stopping Output to the Screen==
 
==Stopping Output to the Screen==
 
To send output solely to the specified printer, and not to the screen, the following commands are required:
 
To send output solely to the specified printer, and not to the screen, the following commands are required:
 +
  
 
<code lang="recital">
 
<code lang="recital">
Line 48: Line 53:
  
 
And to return control to the screen:
 
And to return control to the screen:
 +
  
 
<code lang="recital">
 
<code lang="recital">
Line 58: Line 64:
 
==Printing to a File==
 
==Printing to a File==
 
For printing to a file, the same commands apply, but you should specify the filename in the [[SET PRINTER]] command:
 
For printing to a file, the same commands apply, but you should specify the filename in the [[SET PRINTER]] command:
 +
  
 
<code lang="recital">
 
<code lang="recital">

Revision as of 15:33, 25 March 2009

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.


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 the printer. 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


Printing on Windows

Since Recital Database Server processes are not GUI based, print jobs on Windows systems can only be sent to printers configured for DOS access. The required DOS print command should be specified using the command SET PRINTER TO <OS command>.

For Recital Mirage applications, please see the PRINTFILE() function.