LinePrinter Configuration File

The .NET LinePrinter Configuration File is a user modifiable XML file that contains information about the printers being used. The name and path of the configuration file to be used may be specified in the LinePrinter constructor, or by the ConfigurationFile property of the LinePrinter object.

XML Header

The configuration XML file should have a header of "<?xml version="1.0" encoding="utf-8" ?>" and a base element of <LinePrinterConfig>.  The text of the LinePrinterConfig base element should be "FormatVersion = 1.0".

Entry Entry Type Description
<?xml version="1.0" encoding="utf-8" ?> XML Header Mandatory XML header
LinePrinterConfig Base Element Signifies
FormatVersion = 1.0 Text Required text of the LinePrinterConfig element

Configuration File Sections

After the header are the four primary sections of the file: Printers (required), Notifications (optional), GetStatusSettings (optional), and PrinterPorts (required).

Only the Printers and PrinterPorts sections are required, but if the Notifications and GetStatusSettings sections are included, they must appear in the XML file in this order.

About the Printers Section

The Printers section describes the commands used by the printer. The Printers element should contain one or more child elements, each with properties that describe a particular printer or printer set up. The name of each of the sub element is the printer identifier that is used in the LinePrinter constructor or the PrinterId property of the LinePrinter object.

Entry Entry Type Description
Printers Sub element of LinePrinterConfig Describes the commands used by the various printers.
PrinterId Sub Element of Printers Element

Each PrinterId must be unique. Properties describe commands needed for a particular printer or printer setup.

About the Notifications Section

The optional Notifications section describes the error, warning, or status messages that a printer might return while performing normal print operations. The Notifications element should contain one or more child elements, each with properties that describe the status, warning, or error messages that may be returned by a printer or printer family. The name of each of the child elements is "Notification" property in a PrinterId element, one of the Printers child elements. This section is optional and need not be present if printer feedback is not desired or available.

Entry

Entry Type

Description

Notifications Sub element of LinePrinterConfig Set of notifications that may be received and passed along from the printer.
NotificationName Sub element of Notifications Each NotificationName must be unique within the Notifications section, with a unique identifier referenced by the Notification property of the PrinterId subelement in the Printers section. Each NotificationName element contains information about the Messages sent by a particular printer or printer family.
Message Child elements of NotificationName Element that contains information about one warning or error that the printer may generate.  May be repeated as needed (maximum 30).

About the GetStatusSettings Section

The optional GetStatusSettings section should contain one or more child elements, each with properties that describe the commands needed to retrieve status messages and the status, warning, or error messages that may be returned by a printer or printer family when the GetStatus method is called. The name of each of the child elements is "StatusSettings" property in a PrinterId element, one of the Printers child elements. This section is optional and need not be present if printer feedback is not desired or available.

Entry

Entry Type

Description

GetStatusSettings Sub element of LinePrinterConfig Commands used to retrieve status information from the printer when requested by the GetStatus method.
StatusEntryName Sub element of GetStatusSettings Each StatusEntryName must be unique within the GetStatusSettings  section.  A unique identifier referenced by the StatusSettings property of the PrinterId above.  Each StatusEntryName element contains information about the status Messages sent by a particular printer or printer family in response to a GetStatus method call.
Command Sub element of StatusEntryName Describes one command and possible printer replies for that command to retrieve printer status. May be multiple Command entries for a single StatusEntryName.
Message Child elements of Command Element that contains information about one warning or error that the printer may generate in response to a GetStatus method call.  May be repeated as needed (maximum 30).

About the PrinterPorts Section

The PrinterPorts section describes the connection between the computer and the printer that will be used. Each of these elements may include several child elements. The PrinterPorts element should contain one or more child elements, each with properties that describe a particular communication method between the computer and the printer. The name of each of the child elements is the value of the EntryName property in a PrinterId element, one of the Printers child elements.

Entry Entry Type Description
PrinterPorts Sub element of LinePrinterConfig Describes the connection between the computer and the printer to be used.
PortName Sub Element of PrinterPorts Element Each PrinterId must be unique. Properties describe commands needed for a particular communications port setup.
Transport Type Text Name of the transport type being used to communicate with the printer. Valid values include WPPORT, WIFI, COMx:, IRDA, or SOCKET.

Configuration Strings

The configuration strings are the actual commands or data used to control the printer and are the value of the various properties in the configuration XML file. Follow these syntax rules when entering the data into the file:

For example, a typical property may be entered as: NormalFontSeq="0x1b,w,!"

This would translate to saying that the command to set the normal font for this printer would be <esc>w!, or a byte string of {27,119,33}.  This means that all the entries below are functionally the same.

NormalFontSeq="0x1b,w,!"

NormalFontSeq="27,119,33"

NormalFontSeq="0x1b,0x77,0x21"