Printer setup
The Text Line protocol is configured in the web UI under Settings → Protocols. The protocol can be added on several ports, each with its own settings, for example one port per scanner that should behave differently.
Adding the protocol
- Select Add.
- Choose Text Line / Barcode.
- Enter the TCP port the client will connect to, 11000 by default. The port must not be used by another protocol on the printer.
- Select the new entry and choose Settings to configure it.
Settings
| Field | Description |
|---|---|
| Actions | What to do with each line. See Actions. |
| Error Value | Lines with exactly this text are ignored and a warning is logged. ERROR by default. Leave empty to handle every line. The comparison is case sensitive, and is made after trimming. |
| Trim whitespace | Remove whitespace, such as spaces and tabs, from the start and end of each line before it is used. Called Trim before v6.1. |
| Read timeout | Close the connection when no data arrives for this many seconds while a line is incomplete. It never applies between lines. 1 by default, and 0 turns it off. v6.1 |
Actions
Each action takes the received line as its value, and selects a print job from it. Use Add to create an action and Edit to change the selected one. The actions run in the order they are listed, so a single line can, for example, select different jobs on two printers. To select the same job on several printers, give one action all of them.
There are two types of action:
- Select label uses the value as the name of the label to print.
- Select from table looks up the value in a table, and prints the label given by the matching row.
Action fields
| Field | Description |
|---|---|
| Type | Select label or Select from table. |
| Printers | The printers to select the job on. At least one must be set. Before v6.1, an action had a single printer. v6.1 |
| Pattern | Optional regular expression that picks the part of the line to use: the first group in parentheses if there is one, otherwise the whole match. For example, LOT:(\d+) picks the digits after LOT:. The pattern may match anywhere in the line; use ^ and $ to match the whole line. A line that does not match is skipped by this action, and an error is logged. v5.4 |
| Prefix | Text added before the value. |
| Suffix | Text added after the value. |
| Limit number of prints | Number of copies to print. |
| Minimum trigger distance | Ignore triggers closer than this distance from the position where the job was selected. v5.4 |
| Maximum trigger distance | Ignore triggers farther than this distance from the position where the job was selected. v5.4 |
| Queue label | Add the job to the printer's queue instead of replacing the current job. |
| Use a snapshot of the label | Take the label's content (counters, date and time, table data) when the line is received rather than when the print is triggered. Counters used by the label are stepped when the job is selected. v5.4 |
With several printers, the label is looked up, or the snapshot taken, once, and the same job is selected on every printer, so counters in a snapshot are stepped once. The trigger window is measured from each printer's own position. If a printer is not found, the error is logged, and the job is still selected on the others.
The value is built in this order: the pattern picks part of the line, then the
prefix and suffix are added. With pattern ^(\d+), prefix P- and the line
123 ABC, the value is P-123.
The trigger distances form a trigger window.
Table fields
A Select from table action also has:
| Field | Description |
|---|---|
| Table name | The table to search. |
| Key column | The column to search for the value. |
| Label column | Column holding the name of the label to print for each row. |
| Label name | A fixed label to print. Either this or a label column must be set. |
| Copies column | Optional column holding the number of copies to print for each row. |
| Printed column | Optional column where the number of printed labels is counted. |
These are the same as the table properties of a print job.
Testing
Select the protocol in the list and choose Test to send the contents of a text file to its port, as if it came from a client. Put one value per line, and end the last line with a line break too.
The printer's log shows each received line, and any errors from the actions.
Import and export
Export saves the settings of the selected protocol to a file, and Import… adds a protocol from such a file, on a port of your choice. Use this to copy a configuration between printers. Importing to a port that is already in use replaces the protocol on that port.