Printer Rule

Unofficial Content
This documentation is valid for:

Defines the printer form (a list of printer settings) to be used.
When using the iSeries generator, this rule specifies the printer file to be used in the iSeries.

Syntax

Printer({ 'FormName' | att | &var });

FormName | att | &var : represents the printer form name (i.e., ‘DefaultPrinter’). When using a variable or an attribute, it must be a Character data type.

Description

The printer rule is used to select a printing form.

For each printer rule defined in any report or procedure, a form is generated in a file called GXPRN.INI (located where the application is executed) with the default values taken from the report or procedure.

When the object containing the printer rule is executed, the INI file is opened and the selected form is read to get the associated printer setting; the object is printed using these parameters.

Win environment

You can use the GxSetFrm utility to set the desired value for each form defined; check this article for further information.

Web environment

The GXPRN.INI file must be located in the application virtual directory when using C# generator; for the Java generator locate it in the web application's WEB-INF directory.

The file is automatically created once the report or procedure object is executed (only if the file does not exists); the GeneXus design values are set.
If you want to modify the printer form settings, you have to:

  • stop the application.
  • modify the file manually.
  • restart the application.

iSeries environment

GeneXus uses the General Purpose library (QGPL) QPRINT Printer File by default. The Printer rule allows you to use a different Printer File instead of the QPRINT file, so you can apply whatever options you wish.

The file used must satisfy the following requirements:

  • It must be a Program Defined File (Not DDS).
  • The name cannot have invalid COBOL characters (such as underscore, etc.)
  • The name's length cannot exceed 8 characters in RPG and 10 characters in COBOL.

The procedure suggested to define a Printer File is: copy the QPRINT file and then use the CHGPRTF (Change Printer File) command to set the desired options. 

Note:

For each rule or set of rules, you can force them to be triggered _only_ for certain environment(s). See more details in the following document: Form-specific Events and Rules.

Scope

Objects: Procedures
Languages: .NET, Ruby, Cobol, Java, RPG, Visual FoxPro

See Also

Printing with GeneXus
Client side printing in web applications
GXPRN.INI Format