print

Activate printing.

print{/ask} {/preview}  {PrintJobModel  {,PrintMode  {,USE_SYSTEM_SETTINGS= ( TRUE | FALSE)}}}

Example: print "SALESLASER", "A"

Qualifiers

Qualifiers

Qualifier

Description
/ask Displays the Print form with PrintJobModel and PrintMode as default values, which can be edited by the user.
/preview Displays the Print Preview window, which enables the user to view the printout at different scales, navigate to previous and next pages, print the output, or close the window.

By default, the zoom percentage is Entire Page. You can specify the default zoom percentage for the Preview window using the Printer tab of the Setup menu

Note:  print/preview is supported only on Microsoft Windows 32-bit platforms and for the P_MSWIN3 and P_MSWINX device translation tables.

Parameters

Parameters
Parameter Data Type Description
PrintJobModel String Name of the print job model to use for printing. The print job model determines where and how to print. If omitted, the print job model PRINTER is used.
PrintMode String Mode to use for printing. If omitted, the print mode A (All) is used. Allowed values are:
  • A (All)—print the form or report component and all data in the hitlist.
  • C—like All, but clear the data from memory after printing. It is recommended that you use C when writing reports or report-like forms.
  • F (Current component and data)—print the entire form or report component and all data currently in it.
  • S (Screen)—in character mode, print what is on the screen. In GUI mode, same as F.
USE_SYSTEM_SETTINGS String Determines whether the Microsoft Windows print settings are used, or the current print job settings are used.

TRUE—use Microsoft settings are used. If set to FALSE, the current print job settings override the Windows settings.

If a value other than TRUE or FALSE is provided, Uniface interprets the value as TRUE. Omitting USE_SYSTEM_SETTINGS is equivalent to FALSE.

USE_SYSTEM_SETTINGS is only available on Microsoft Windows platforms, and is only supported for the P_MSWIN3 and P_MSWINX device translation tables.

Return Values

Values returned in $status
Value Meaning
0 Statement executed successfully
<0
An error occurred. $procerror contains the exact error.
>0 An error occurred in the range in the range 1410 to 1415, or 2003.
Values commonly returned by $procerror following print
Value Error constant Meaning
-400 <UMISERR_PRINT>

Uniface could not print, for example:

  • Printing is already being performed ($printing=1).
  • ^QUIT was used in the Print form.
  • The print mode is not valid.
1410   Internal printing error occurred.
1411   Invalid margins specified.
1412   Data too large for printer margin settings.
1413   Widget does not have print capability.
1414   EPI request not supported by print driver.
1415   Print queue not supported by print driver.
2003   Cannot open file.

Use

Use in Form and Report components.

print/ask and print/preview are allowed only in Form components.

print/preview is allowed in Form components and in Report components in test mode.

Description

The print statement activates printing in Uniface, using the PrintJobModel, PrintMode, and settings specified.

Note:  When a print statement is encountered in an operation that is being executed on the server, the print job models available are those on the server (in the Repository entity PRATT.PRINTER).

The print statement is executed unseen by the user and is therefore best used in reports and batch mode applications.

In form component, you can use print/ask to prompt for information, enabling the user to choose a different printer or a different layout to suit their requirements. The print/ask statement takes the supplied parameters (print job model and print mode) and presents the user with the Print form already filled in. This allows users to interactively tailor the printer specifications according to their requirements.

Printing Records in a Hitlist (With Confirmation)

The following example prints all the information in the hitlist to the printer described by print job model SALESLASER. The user is prompted to confirm the values used.

print/ask "SALESLASER","A"

This produces the display shown in the following figure:

Print dialog with SALESLASER as Print Job Model

Printing Records in a Hitlist (Without Confirmation)

The following example prints all the records in the hitlist, using the values given in the SALESLASER print job model. The user is not given the opportunity to modify any values.

operation exec
; use SALESLASER print job model, option All

  custname = $1
  retrieve
  print "SALESLASER", "A"
  if ($status = 0)
     message "Print completed."
  else
     message "Error %%$status, printing may have failed"
  endif
  exit (0)
end; exec

Related Topics