Local Print Object
Limitless Terminal Printing Possibilities
When you have a need for more capability than you can get out
of standard print handlers, Local Print Objects or LPOs are the
way to go. You can create LPOs to interpret, integrate or
extend normal host print data to special printing requirements
or into other Windows applications.
What exactly is a Local Print Object?
A Local Print Object is a user-written terminal print handler
used in place of normal terminal printing provided by the
eXpress and QPlex terminal emulation series from KMSYS
Worldwide, Inc.. LPOs are written as out-of-process OLE
servers. LPOs can be written
using any programming language that can be used to create an
out-of-process OLE server such as Visual Basic, C++, Delphi,
etc.
Why Use Local Print Objects?
The terminal emulators from KMSYS Worldwide, Inc., like those
from other vendors, perform printing exactly like the old
hardware terminals they emulate with very few exceptions;
however, many times additional printing requirements may be
needed.
One example of a special printing requirement, and the one
that LPO technology was originally developed to satisfy, is
translation of city codes to Chinese for Chinese airline ticket
printing. In this case, the host application sends what looks
like a standard airline ticket to the terminal emulator to be
printed on a ticket form.
![](LocalPrintObject_AirlineTickets.jpg)
When the emulator receives the print
command (DC2 control sequence) it passes the information to a
custom LPO instead of the printer. The LPO reads the data, does
a lookup of the city codes and translates them into the Chinese
city name using Chinese characters. The data is then formatted
into a standard ticket form with the Chinese city names added
and sent to the printer.
Other possibilities are bar code printing for inventory
management systems or airline baggage tags. Another application
might integrate the host print data with data from other sources
(a network database, spreadsheet, etc.) to enhance the final
printed information. Furthermore, host print data does not
necessarily have to be printed. The LPO can be used to place the
information in other databases or to send directly to other
applications. One LPO currently in use collects all print data
into a continuous text file which is restarted each day.
These files are used for audit and analysis.
How Do Local Print Objects Work?
As mentioned earlier, LPOs are written as out-of-process OLE
servers. To work with eXpress or QPlex terminal emulators, the
only requirement is that the LPO publish five standard methods
(or functions) defined as follows:
LPO_Initialize
LPO_Initialize is called once by the emulator just before the
first call to LPO_Open. This method is provided to allow the LPO
to perform any user-defined one-time initialization. If no
action is needed this function should just return a 1.
Format:
Function LPO_Initialize (Options as Integer) as Integer
Options is the contents of the User Options entry on the printer
device setup configuration. The LPO developer defines the
content and use of this parameter. The emulator does not
use or modify it in any way.
The LPO_Initialize function must return the Window Handle of
the LPO's main window if successful, or a zero if not
successful. A Windows WM_Close message is posted to the LPO's
main window using this handle when the UTS screen is closed. This action is done to close the LPO
automatically when its client UTS screen is closed.
LPO_Open
LPO_Open is called whenever the emulator opens the printer.
Format:
Function LPO_Open (ScreenRows as Integer,
ScreenColumns as
Integer) as Integer
The emulator passes the screen size of the current screen in
the ScreenRows and ScreenColumns parameters.
The return value must be a 1 or 0 indicating success or
failure, respectively.
LPO_PrintData
LPO_PrintData is called whenever the emulator receives a
screen print command. The command can come from the host or the
keyboard.
Format:
Function LPO_PrintData (ScreenData as WideString,
ScreenAttributes as WideString, CursorRow as Integer,
CursorColumn as Integer, Flags as Integer) as Integer
ScreenData and ScreenAttributes are passed as WideStrings,
but are used as arrays of word (unsigned, 16-bit integers).
The ScreenData array contains ALL characters in the screen. Double-byte characters are ORed
with 100 hex for the lead byte and 200 hex for the trailing
byte.
ScreenAttributes contains the attribute flags associated with
the corresponding screen character. Attributes are defined as
follows:
The Flags parameter indicates the type of terminal print
function requested. For UTS emulators, Flags are defined
as follows: 0 = Print; 1 = Print Form; 2 = Print Transparent; 4
= Print Screen All.
The return value must be a 1 or 0 indicating success or
failure, respectively.
LPO_Close
LPO_Close is called whenever the emulator closes the current
print operation. The printer is closed when one of the following
occurs: the screen is closed; the user closes the printer from
the screens file menu; or the printer timeout limit is reached.
Format:
Function LPO_Close as Integer
The return value must be a 1 or 0 indicating success or
failure, respectively.
How is an LPO selected?
Once the LPO is created, you simply configure (select) it in
any KMSYS Worldwide, Inc. emulator as you would any standard printer.
So, spring into action today and give LPOs a try. If you have
any questions or think that LPOs might be a part of your
application solution, please contact us.
We are always willing to help and are easy to reach.
|