Printing - Printer Session

Note:
Applet technology will soon be deprecated or no longer supported in new browser versions. An alternative for host printing is provided using Java Web Start technology. See To test HostPrint in the Web application under Getting Started with the ApplinX Printer.


Testing the Printlet Connectivity to the Host (via the ApplinX Designer)

The object of this task is to verify that ApplinX is able to connect to and activate a printer session. As this is only performed in order to confirm connectivity, the task describes the necessary steps performed using the ApplinX Designer. To deploy ApplinX using the printing options, refer to Deploying the Printlet.

Start of instruction setTo test the Printlet Connectivity:

  1. Open the application properties in ApplinX Designer, Application Properties>Printer tab, and select the Enable printer checkbox. By default, when creating a new application, the printer is enabled.

  2. Right-click on the Session node and select New Printer Session Definition.

  3. Enter a name for the session definitions.

  4. Select the connectivity type:

    • Use application configuration: Use the configuration set in the Application Properties.

    • Online: Connect online to the host, and enter the name of the device.

    • Offline (using trace files): Connect to the session using a trace file. Browse and select the required trace file.

  5. Click Next to display the General Session Properties.

  6. When necessary fill in the session ID and password.

  7. Determine whether you would like to create a trace file of the session.

  8. Click Finish. The Printer session definition will be added to the Sessions node of the relevant application.

  9. Double-click on the Printer session definitions to test the connection to the host. A new window will come up, containing the ApplinX printlet (printer applet), displaying the printing configuration. The printer status is "Ready". When a print job is sent to the defined device name, the Printer dialog box is displayed and you can print the print job to the local printer.

Deploying the Printlet

When deploying the Web application, the Printlet will need to be configured for a number of users. Each user may require different Printlet behavior for printing jobs. These differences may be for example, using a different device name per user, or using different fonts and layout parameters. Parameters, such as the printer device name that changes according to the current user, must use dynamic code. The dynamic code must retrieve the information (that may be held, for example, in a database or XML file), per user.

Note:
The method in which printing jobs are executed may depend on settings such as whether the job will be printed silently without invoking a print dialog box first or whether the print dialog box will be displayed only the first time you print in the current session. These settings are defined in various parameters as detailed in the Printlet API.

Start of instruction setTo Activate the printer session in the Web application (JSP):

  1. Open the page run_printlet.jsp.

  2. Set the parameters of the printer applet: application and device_name.

  3. Open a browser and run the page run_printlet.jsp. The applet is displayed, the status is "Ready". When a print job is sent to the defined device name, the Printer dialog box is displayed and you can print the print job to the local printer.

Notes:

  1. The Options button is only enabled in Mainframe hosts.
  2. The Printlet component is not supported for Microsoft Edge Browser.

Start of instruction setTo Activate the printer session in the Web application (.NET):

  1. Open the page dotnet\web\cs\New Application\run_printlet.aspx.

  2. Set the properties of the printer control (optionally in the designer): application, device_name.

  3. Open a browser and run the page run_printlet.aspx. The applet is displayed, the status is "Ready". When a print job is sent to the defined device name, the Printer dialog box is displayed and you can print the print job to the local printer.

Notes:

  1. The Options button is only enabled in Mainframe hosts.
  2. The Printlet component is not supported for Microsoft Edge Browser.

Start of instruction setLaunching the Printlet (run_printlet)

There are two options as to how to open the Printlet (run_printlet):

  1. Launch the printlet in a new browser window: Add a button to the master page (template.jsp/template.master.cs). Place the button where you desire. Set the button to open the run_printlet.jsp/aspx in a new window.

    For example: <input type="button" value="Print" onclick="window.open('run_printlet.jsp');" />

    Refer to the API:

    Or:

  2. Load the printer as an internal frame of your web application (the printlet will always stay active):

    1. In the Framework Configuration Editor, in the Emulation node check the Load printer applet within internal frame checkbox (refer to Configuring your Web Application) OR In the web application root directory, open the config/gx_clientConfig.xml file and set the LoadPrinter value to "true".

    2. To show the frame of the printer use the gx_showPrinter() function.

      To hide the frame of the printer use the gx_hidePrinter() function. By default run_printlet.jsp/aspx has this function mapped to a button.

      Example: <input type="button" value="Show Printer" onclick="gx_showPrinter();" />

Getting Started with the ApplinX Printer

This task will cover the basic steps required in order to achieve a first test print.

Start of instruction setTo start working with the ApplinX Printer

  1. Open the application properties in ApplinX Designer, Application Configuration>Printer tab, and select the Enable printer checkbox.

  2. Click OK. A Printer session node will be added to the application node in the Designer.

Start of instruction setTo test the printer in the ApplinX Designer

  1. Click on the Printer session node to test the connection to the host. The Connection dialog box is displayed. Click Connect to test the connection.

  2. The right pane of the Designer displays the printing configuration. The Session status is "Connected to server". When a print job is sent to the defined device name, the Printer dialog box is displayed and you can print the print job to the local printer.

Start of instruction setTo test hostPrint in the Web application

  1. Set the application parameters in file hostPrint.jsp/aspx. Add the parameters to the tag <gx:jnlp> in key=value format. For example:

    <gx:jnlp  gx_context="contexts.GXInstantLogicContext"  password="" description="" >

    Do not modify the gx_context parameter.

  2. Open a browser and run the page hostPrint.jsp/aspx. A JNLP file is downloaded and - depending on the browser - will open automatically or you have to open it manually. Once it is running, the hostPrint window is displayed and the status is "Connected". When a print job is sent to the defined device name, the Printer dialog box is displayed and you can print the print job to the local printer.

    Note:
    The Options button is only enabled in Mainframe hosts.

    Important:
    The JNLP file is opened using Java Web Start (javaw.exe), which will no longer be supported after Java 8. If you are using a Java version higher than Java 8 or an open JDK, you will not be able to open the downloaded JNLP file. In this case, use the OpenWebStart tool, an open source reimplementation of the Java Web Start technology.

Configuring and Testing Various Printing Jobs

There are a number of parameters which enable defining the printing job output to suit the specific customer requirements (Refer to the Printlet API).

Start of instruction setTo configure and test printing jobs:

  1. Connect the Printlet to the host (refer to Connecting the Printlet to the Host).

  2. In the Printer Session Properties, set the Printlet parameters according to the parameters of the emulation you are currently using (for example, the number of lines to be printed per page, CPI, LPI etc.).

    graphics/printersessionprinter.png

  3. Print a variety of typical jobs, such as 132 characters, landscape, portrait, a number of pages, barcode printing etc.

  4. Change the printer parameters to fine-tune the printing jobs and provide satisfactory results.

Tracing Printer Sessions

Start of instruction setTo trace a printer session:

  1. To define that every printer session will be traced, open the application properties in ApplinX Designer, Application Propterties>Printer tab.

    To define the trace file for a specific printer session definition, refer to Getting Started with ApplinX Printer.

  2. Select the Trace>File name checkbox, and enter a file name

  3. Select the Session ID checkbox. This option will create a separate trace file for each user.

  4. Select the Time checkbox, to create a separate trace file for each session created by a different user.