Enabling print support

As you develop a HATS project, you can establish a print session for the associated host application. When the HATS application is running in a production environment, a user of the application can print data or display data that is formatted for printing. Print support settings only apply to the default HATS connection.

When interacting directly with a host application, a user activates a physical printer to print data from the application. When interacting with a HATS application, the user does not activate a physical printer. Rather, a print file is generated, which can be displayed by the user . The print file can also be printed.

Note:
If the print file is an Adobe PDF file and a PDF viewer (Adobe Acrobat Reader) is not installed, the user will be prompted to save the file to disk.

This chapter describes the process for enabling print support in your HATS project and for using print support in the HATS Toolkit environment and in the runtime environment for deployed applications.

Configuring the host print session on 3270 hosts

Before setting up print support for your HATS project, make sure that you, or the system administrator, have performed the following configuration for the host print session:

Refer to the documentation for your 3270 host software for details on how to perform these steps.

Defining print support for your project

For print support to be available for your project, you must obtain the host name and the port number for the Telnet server from the system administrator. Enter these values when you define the connection settings for your project.

For 3270E connections

To define print support for 3270E connections, take the following steps:

When a user of the HATS application issues a command to print files, the host application sends a print job to the printer LU and the HATS runtime converts the print job to the format configured for the connection. Once the file is formatted, the user can click View Print Jobs to see a list of queued print jobs. For Web applications this is a button on the application keypad. For rich client applications it is an item on the pop-up menu in the Applications view.

Note:
Each user has a separate list of available print jobs. Jobs printed by one user are not visible to another user.

Jobs in the queue can be opened or deleted by clicking the appropriate icons. For example, if open is selected for a PDF file and a viewer program is installed, such as Adobe Acrobat, the viewer program will open with the specified file. The file can be printed or saved at this point. If for example a PDF viewer is not installed, the user is prompted to save the file (as a .pdf file). The saved file can be opened from another system that has a PDF viewer program installed.

Notes:
  1. For HATS Web applications, the print files are stored on the WebSphere® Application Server system. If you terminate the HATS application, you will lose all print files in the queue.
  2. For HATS rich client applications, the print files are stored on the rich client workstation. The user can select whether to delete the files when the rich client environment is closed. See Print preferences for how this is done.
  3. If the application has been configured to send the print jobs directly to a printer, the print files are not stored anywhere. The user cannot view or delete the jobs from this panel, but can see that they were received until they have finished printing.
  4. Adobe Reader 9 is required to view PDFs created for 3270E connections that use Japanese host code pages 1390 or 1399. To create PDFs files that contain no JIS2004 characters and can be viewed with Adobe Reader 8, you must disable JIS2004 support for the 3270E connection. For how to do this, see Disabling JIS2004 support for code pages 1390 and 1399.

Using the Host On-Demand PDT compiler

The Host On-Demand PDT compiler is supplied as a convenience for users who need to create new Host On-Demand Printer Definition Table (PDT) files for 3270E host printing. PDT files are not typically needed, but can be used if necessary to create binary print output files for specific non-Windows customized printer types. PDT files are created by first creating or modifying a source Printer Definition File (PDF) and then compiling it into a binary PDT file. PDT files are not used for printing to Windows printers.

To create a new PDT file, copy your source PDF into the <RationalSDP_install_directory>\hats\PDT\pdfpdt\usrpdf\ directory. A collection of sample source PDFs is provided in this directory. Unzip the sample PDFs into the usrpdf directory to modify or compile them. Open a command prompt to the <RationalSDP_install_directory>\hats\PDT\ directory and run the pdtcom.bat command. The Compile a Printer Definition Table window opens. In this window, select your source file from the drop-down box, enter a description, and click the OK button to compile it into a PDT file. The compiled PDT file is stored in the <RationalSDP_install_directory>\hats\PDT\pdfpdt\ directory. The file extension of the compiled PDT file is .hodpdt.

Copy the compiled PDT file into a folder, for example, MyPDT, in the root of the .ear project for your HATS Web application, or in the root of the HATS RCP Runtime Extension project for your HATS rich client project, or into a folder within the WEB-INF folder for your HATS portlet project.

The compiled PDT file is configured to HATS on the Printing tab of the connection editor for the default connection. In the Initialize section, select Basic text files (Plain text format) and click the Initialize button. In the Name/Value table, set the PDTFile property to have a value like MyPDT/usribm3250.hodpdt. Also set the printMimeType property to application/octet-stream and the usePDT property to true. For more information see Printing. Users will retrieve their 3270E print output as a binary print file suitable for copying to a particular type of non-Windows printer.

More information on Host On-Demand PDF and PDT files can be found in the Host On-Demand Knowledge Center at http://publib.boulder.ibm.com/infocenter/hodhelp/v11r0/index.jsp?topic=/com.ibm.hod.doc/doc/troubleshoot/pdtcompile.html.

Notes:
  1. Printer Definition Files have no relation to Adobe Portable Document Format files.
  2. If you have an existing PDT file from other HOD installations, you can use it for your custom printer without recompiling it. Simply copy the PDT file into place in the Web or rich client project as directed above, and set the default connection's print settings to use it.
  3. For more information about Japanese JIS2004 support, see JIS2004 support for PDT printing and Print-to-File for 3270E sessions.

For 5250 connections

To define print support for 5250 connections, in the editor for your 5250 default connection, click the Printing tab and select the Enable print support check box. Provide a URL for the System i® Access for Web Printer Output window. The default URL is http://hostname/webaccess/iWASpool, where hostname is the name of the 5250 server. Print support for 5250 servers requires that System i Access for Web is installed on the 5250 host containing the print spool. All 5250 print functionality is provided by the System i Access for Web Printer Output servlet on the target 5250 host.

You do not need to perform any additional configuration. When a user of the HATS application issues a command to print files, System i Access for Web converts the host print jobs into PDF format and facilitates the download to the user. The user can click View Print Jobs on the application keypad to display the System i Access for Web Printer Output window. In this window, the user can select the following print options:

  1. PDF device type
  2. Paper size
  3. Destination

Refer to your System i Access for Web documentation for more information about these print options.

Providing documentation for users

To facilitate use of your HATS applications by users, it is recommend that you provide documentation on how to use the print support in HATS. Your documentation--provided either in the application's graphical user interface or in some other easily displayed form (perhaps a link in your template)--should describe:

To use HATS print support, a user should follow these steps:

  1. Start the HATS application.
  2. Print the files.
  3. Click View Print Jobs. For Web applications this is a button on the application keypad. For rich client applications it is an item on the pop-up menu in the Applications view. The Printer Output window displays a list of print jobs, if any exist.

    In the Printer Output window, the user can click options for a print job to either Open or Delete it. If the user clicks open, the print job is displayed as a PDF file in Acrobat Reader, if it is available. If not, the user is prompted to save the file to disk.

    Notes:
    1. While the print jobs are spooling, the user might see the file names for the print jobs in the printer output window, but View and Delete are disabled until the conversion to PDF format is complete.
    2. Each user has a separate list of available print jobs. Jobs printed by one user are not visible to another user.