ApplinX supports printer sessions only on AS/400 and mainframe hosts. It connects to the host, retrieves the print buffers and analyzes them. The host handles the printer's queue and the connection of printer sessions to display sessions. ApplinX connects to the host as a printer session to receive the print buffers and allows you to work with them.
The printer solution of ApplinX has two implementations. The first is by way of the Application Programming Interface (API), which reflects the data returned into the programming environment. From there, the data is sent to databases, email, Web or desktop applications.
The second option is the default behavior of an emulator, where ApplinX sends all print jobs to the client's machine by means of a printer applet that runs on the client's browser.
See the ApplinX API Specification (Javadoc).
ApplinX supports printer sessions only on AS400 and mainframe hosts. It connects to the host, retrieves the print buffers and analyzes them. The host handles the printer's queue and the connection of printer sessions to display sessions. ApplinX connects to the host as a printer session to receive the print buffers and allows you to work with them.
The printer solution of ApplinX has two implementations. The first is by way of the Application Programming Interface (API). The second option is the default behavior of an emulator, where ApplinX sends all print jobs to the client's machine by means of an applet that runs on the client's browser. The applet runs on the supported browsers using the Java plug-in technology. It is a signed applet, because it is Java code and it invokes the client machine's print dialog, which requires permissions that exceed regular applet permissions. Once the applet is signed it can only address a server where the applet originated, so ensure that the Web server and ApplinX server are on the same machine or failing this, use the ApplinX Redirector .
The printer applet receives parameters. The following lists describe the parameters and a brief description of each. They are all optional except for serverURL, application and device name/associate device name (mainframe only).
The printer applet is activated using the page run_printlet.aspx (default). The page's name can be changed, or the printer control (which generates an applet tag) from it can be moved to any other page.
The connection parameters customize the connection to the ApplinX server.
Connection Parameter | Description |
---|---|
userid | The user's ID (obligatory). |
password | The user's password. The password that connects the user to the ApplinX server. |
description | A textual string describing the ApplinX SessionID attached to the instance of the ABO. Helpful to distinguish users in the ApplinX Administrator. |
serverURL | The method is set by setServerURL("applinx://<serveraddress>:<serverport>") Secured SSL socket: setServerURL( "applinxs://<serveraddress>:<serverport>") Note: Memory sharing method is not suitable. |
application | The ApplinX application name. By default, it is the default application of the ApplinX server. |
device_name | The name of the printer device as defined in the host. |
associate_device_name | The name of the display device (on the host) that the printer should connect to. Note: Applicable for Mainframes only. The host handles the linkage of printer session to the display device. |
message_queue | The name of the queue where messages about printing are sent. Note: Applicable for AS400 only. |
message_lib | The name of the library where messages about printing are sent. Note: Applicable for AS400 only. |
host_address | The host address where the printer device is defined. |
host_port | The host port that the printer device is defined to work with. |
auto_reconnect_number_of_tries | The number of times to try to reconnect to ApplinX server. |
auto_reconnect_time_interval | The interval between each attempt to reconnect to the ApplinX server. |
disconnect_previous_session | Disconnects the previous session and creates a new session in cases where the network was disconnected and the user was still connected to ApplinX server. |
The Specific Printer Device parameter printer_device, allows you to set the applet to print silently to a specific printer without invoking a print dialog first. Specify one of the following values:
The value "<default>" indicates that the applet should print to the default printer silently.
The value "<First Selected Printer>" indicates that the Print dialog is displayed the first time you print in the current session. The applet will print silently to this printer in additional print jobs in the same session.
The value of the parameter is the name of a specific printer. This printer must appear on the list of available printers on the computer where the applet will run.
As the page that invokes the applet is a Web page, the same page is executed for all users. If you require different settings for selective users, change the parameter value accordingly.
The print mode determines whether the printing layout is graphical or defined by the printer. When defined by the printer, all Print Format and Fit-to-Page Format parameters are ignored. The layout must be defined by the printer when the print data includes transparent commands. The print mode feature is only supported when using Microsoft JVM.
bypass_gdi | Possible values are False (default), indicating that the printing layout is graphical or True, indicating that the printer will define the layout. |
Print to File Parameter | Description |
---|---|
output_file_name | The file name to which you want to print the job. It is possible to add a time stamp to the file name (%t), creating a new file for each print job. |
append_to_file | When True, print jobs in the same session are added to the same file. By default false. |
printjob_separator_text | When using the options print_as_text and append_to_file, a few print jobs may be printed to the same text file. When this happens, the text set to the parameter "printjob_separator_text" will be printed to the file between consequent print jobs. |
printjob_separator_add_new_line | When using the option to append_to_file, a few print jobs may be printed to the same text file. When this happens, they can be separated by adding a new line between consequent print jobs. |
print_as_text | Determines whether the job will be printed to a file (true) or to the printer (false-default). |
Print Data Retrieval Parameter | Description |
---|---|
wait | The time to wait for each job to end (default 1 minute). |
sleep | The time in between requests to determine the end of a print job. |
Applet Parameters | Description |
---|---|
loglevel | Advises the applet how much and what to write to the log. Values can be normal (default) or debug. |
enable_presentation | Setting the value to true displays the graphic user interface of the applet. If it is false, the log of the applet can still be viewed via the browser Java console (default: true). |
Buffer Analysis Parameters | Description |
---|---|
lines_per_page | Sets lines per page. Usually, set according to the host's definition (default value equals 66 or if value is set to "0"). However, you can override this according to your requirements. Page is cut when it reaches the number of lines per page. |
characters_per_line | Sets characters per line. Usually, set according to the host's definition (default value equals 80 or if value is set to "0". However, you can override this according to your requirements. Line is cut when it reaches the number of characters per line. |
exclude_last_page_if_empty | It is possible to define that when the last page of a print job is blank, this page will not be printed. |
exclude_last_line_if_empty | It is possible to define that when the last line of a print job is blank, this line will not be printed. |
do_not_add_form_feed_at_end_of_job | By default, the value of this parameter is false, printing the blank page. By default at the end of a printing job, the Printlet sends the from feed command to the printer. To disable this option, set this parameter to TRUE. |
do_not_print_siso_as_space | Determines whether to print Shift-In and Shift-Out as spaces. Possible values: true, false. By default: TRUE. |
treat_carriage_return_as_new_line | Treats carriage return as a new line. By default, set to FALSE. |
Do_not_return_print_buffers | The contents of the print job will not be saved to memory, therefore it will not be possible to retrieve the contents using getOriginalBuffer. By default the contents are saved to the buffer (FALSE). Change the value to TRUE so as not to save the contents. |
Throughout the printed data, transparent commands may appear. The applet is capable of identifying these transparent commands (this feature is applicable to LU3, 3270 protocol). These transparent commands, such as PCL commands, are analyzed by the front end printer and are identified by the textual characters which appear at the beginning and end of these commands (the textual characters can be one or two characters). The following two parameters are used to identify the textual characters. When these parameters are not defined, and the data includes transparent commands, the commands will be printed as part of the regular data. In order for the commands to be sent to the printer, bypass_gdi parameter must be set to TRUE.
Parameter | Description |
---|---|
transparent_start_trigger | Defines one or two characters used to identify the beginning of the transparent commands. |
transparent_end_trigger | Defines one or two characters used to identify the end of the transparent commands. |
Print Parameters | Description |
---|---|
font_name | Default font name is Courier New. |
font_size | Default font size is 10. |
font_bold | Default is not bold (false). |
font_italic | Default is not italics (false). |
CPI(characters per inch), LPI(lines per inch) | Any negative number results in the best-fit print job. Density is determined according to the font size. Zero value sets CPI/LPI values as defined in the host (default). If dynamic settings are on, the value of CPI/LPI parameters is ignored. Positive number results in a manual fixed value, as follows: LPI: 4, 5.3, 6, 6.3, 8, 8.5, 9.6, 12, 24, 48 CPI: 5, 10, 12, 13.33, 15, 17.14, 20, 26.66 |
left_margin | Set margins for a page (default = 0). |
top_margin | Set margins for a page (default = 0). |
Sometimes print jobs can vary between portrait and landscape format, or the host settings may not fit the current printers used by the end users. So you may use dynamic settings to squeeze print jobs into the correct page dimensions. Dynamic settings include the changing of the font and CPI/LPI settings according to the number of rows and columns in a print job.
By default, the font size is set by the parameter font_size. If the parameter change_font_size_by_chars_per_line is set to true, the printer applet dynamically reduces the font size (if necessary) for every print job, according to the number of characters in the longest line of the first page. The minimum size of font is set by the parameter minimal_font_size. If the minimal font size still doesn't fit, and the parameter change_orientation_by_chars_per_line is set to true, the printer applet sets the orientation to Landscape, and sets the font back to font_size. If it still does not fit, it reduces the font size again until it fits the page.
The parameter check_each_page_separately indicates whether the font should be checked separately for each page in the print job.
Parameters | Description |
---|---|
orientation_type | Forces specific orientation: portrait or landscape (default: use_host (applies the host orientation definitions)). This option does not function in MSJVM. |
change_font_size_by_chars_per_line | Searches for the longest line on the page, checks if the characters in the line fit into the page dimensions. If negative, will change font accordingly. If minimal_font_size is empty, the applet will not reduce the font size (default: false). Ensure that you defined the characters_per_line parameter. |
change_orientation_by_chars_per_line | Automatically changes the orientation to landscape when text does not fit in portrait page (default: false). Ensure that you defined the characters_per_line parameter. |
minimal_font_size | The minimum size of font is set by this parameter. Must be set in order for change_font_size_by_chars_per_line to work. |
check_each_page_separately | Indicates whether the font should be checked separately for each page in the print job (default: false). |
right_margin | When you set the right margin, you limit the printable area of the page. If you use dynamic font settings then the applet will squeeze in within the printable area. Note: When dynamic font settings are disabled, the font size and CPI/LPI are fixed values. The right margin is ignored as these fixed values take precedence. |
bottom_margin | When you set the bottom margin, you limit the printable area of the page. If you use dynamic font settings then the applet will squeeze in within the printable area. Note: When dynamic font settings are disabled, the font size and CPI/LPI are fixed values. The right margin is ignored as these fixed values take precedence. |
best_fit_row_proportion | Percentage of font size, to use as best fit row proportion. Used in cases where a print job has a relatively small number of lines. The printlet will increase the proportion of the row gradually (so it still fits the page). Example value: 130%. |
New classes in the ApplinX BaseObject
API provide an additional means of activating a mainframe or AS/400 printer session.
This approach is "zero-client footprint", that is,
there is no software footprint on the client platform.
The following code snippet provides an example:
GXCreateSessionRequest createSessionRequest = new GXActivatePrinterRequest( getDefaultServerAddress(), getAppName(), getPrinterParameters()); GXIClientBaseObject bo = GXClientBaseObjectFactory.getBaseObject(createSessionRequest); GXBooks[] books = bo.getPrints(); for (GXBook book : books) { String bookAsHtml = GXHTMLPrintBookBuilder().build(book); } GXClientBaseObjectFactory.endSession(bo);
For details see package com.sabratec.applinx.baseobject.print
in the Javadoc.
For details see package com.sabratec.applinx.baseobject.print
in the Javadoc.