Difference between revisions of "Printing"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
{{YLM to tidy up}}
 
=Printing=
 
 
 
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.
 
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==
 
==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">
 
print <filename>
 
print <filename>
 +
</code>
  
To redirect output to a system printer, the command SET PRINTER TO SPOOLER is used.  This picks up the environment variable DB_PRINT (set in profile.db).  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>
 
DB_PRINT="lp -dmyprinter -onobanner"
 
DB_PRINT="lp -dmyprinter -onobanner"
 +
</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 product home directory, e.g. "print.unix" in the UD 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 profile.db, 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">
 
set printer to spooler
 
set printer to spooler
 
list status to print
 
list status to print
 
set printer to
 
set printer to
 +
</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):
  
 +
<code lang="recital">
 
set printer to spooler
 
set printer to spooler
 
set print on
 
set print on
&& …output
+
&& ...output
 
set print off
 
set print off
 
set printer to
 
set printer to
 +
</code>
  
  
Line 32: Line 40:
 
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">
 
set screenmap off
 
set screenmap off
 
set console off
 
set console off
 
set device to print
 
set device to print
 +
</code>
  
 
And to return control to the screen:
 
And to return control to the screen:
  
 +
<code lang="recital">
 
set device to screen
 
set device to screen
 
set console on
 
set console on
 
set screenmap on
 
set screenmap on
 +
</code>
  
  
 
==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 TO command:
+
For printing to a file, the same commands apply, but you should specify the filename in the [[SET PRINTER]] command:
  
 +
<code lang="recital">
 
set printer to myfile.txt
 
set printer to myfile.txt
 
list memory to print
 
list memory to print
 
set printer to
 
set printer to
 +
</code>
  
  
 
==Printing to a Slave Printer==
 
==Printing to a Slave Printer==
If you have a printer attached to the printer port of your terminal or PC, the SET PRINTER TO command is not required.  Use the SET PRINT ON / OFF 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.
+
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 Files|Terminal Definition File]] are used.
  
// Program to send display to local printer
 
  
 +
<code lang="recital">
 +
// Program to send display to local printer
 
set screenmap off
 
set screenmap off
 
set console off
 
set console off
Line 65: Line 80:
 
set console on
 
set console on
 
set screenmap on
 
set screenmap on
 +
</code>
  
  
 
==Sending Control Sequences==
 
==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.
+
Control sequences can be sent to your printer using the ? or ?? commands.  The command [[SET SCREENMAP|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
 
  
 +
<code lang="recital">
 +
// Program sending control sequences and text to a file
 
set printer to myfile.txt
 
set printer to myfile.txt
 
set screenmap off
 
set screenmap off
Line 88: Line 105:
 
set console on
 
set console on
 
set screenmap on
 
set screenmap on
 +
</code>
  
 
Control sequences sent must be appropriate to your printer.
 
Control sequences sent must be appropriate to your printer.
Line 93: Line 111:
  
 
==PRINTSCREEN()==
 
==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.
+
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.
 +
 
  
 +
<code lang="recital">
 
// Hot key procedure
 
// Hot key procedure
 
procedure pscreen
 
procedure pscreen
Line 104: Line 124:
 
// Current screen is sent to system printer when [TAB] key is pressed
 
// Current screen is sent to system printer when [TAB] key is pressed
 
on key label tab do pscreen
 
on key label tab do pscreen
 +
</code>
  
  
 
==Printing on Windows==
 
==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>.
+
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|SET PRINTER TO <OS command>]].
  
For Recital Mirage applications, please see the PRINTFILE() function.
+
For Recital Mirage applications, please see the [[PRINTFILE()]] function.
  
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Reference]]
 
[[Category:Reference]]

Revision as of 15:30, 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.