
Device::TLSPrinter - Module for using a TLS barcode printer

Version 0.02

use Device::TLSPrinter;
# use a printer connected to the serial port
my $printer = Device::TLSPrinter->new(type => "serial", device => "/dev/ttyS0");
# use a printer connected to the serial port, reusing an
# existing Device::SerialPort or Win32::SerialPort object
my $printer = Device::TLSPrinter->new(device => $serial_device);
# connect to a printer shared by network
my $printer = Device::TLSPrinter->new(type => "network", device => "host:port");

This module is a driver for the TLS PC Link thermal labeling printer. It implements the commands from the Datamax Programming Language (DPL) recognized by the TLS PC Link printer.

Create and return a new object.
Parameters
type - specify the type of connection, either serial or networkdevice - (mandatory) specify a device name or path to use, or the host and port to connect to (depending on the connection type)Transmit a command to the printer.
Parameters
cmd - (mandatory) command string to sendexpect - if the command expects an answer, indicate the number of characters to readReturns true if feedback characters are enabled.
Returns true if immediate commands are enabled.
Returns true if currently in label editing mode.
Reset the printer: return all settings to the default, clear all buffers and the internal RAM. Return the firmware version. See [TLS-PG] p.7
Fetch and returns the printer status. See [TLS-PG] p.8
Returns
Example
my ($rc, $raw, %status) = $device->ic_printer_status()
Pause or resume the current print job. See [TLS-PG] p.9
Cancel the current print job. See [TLS-PG] p.10
Disable immediate commands. They can be enabled again using sc_enable_immediate_cmds(). See [TLS-PG] p.10
Fetch and return the quantity of label left to print in the current batch. See [TLS-PG] p.10
Example
my ($rc, $qty) = $device->ic_batch_quantity()
Disable feedback characters. See [TLS-PG] p.12
Enable feedback characters. See [TLS-PG] p.12
Adjust the time during which the dots on the printhead are heated. See [TLS-PG] p.13
Arguments
See [TLS-PG] p.13
See [TLS-PG] p.14
Set the quantity of labels to print using the current label format. See [TLS-PG] p.14
Arguments
Feed one label to the top of form. See [TLS-PG] p.15
Adjust the cutter stop position. See [TLS-PG] p.15
Print the label format currently in memory. See [TLS-PG] p.16
Enable immediate commands. See [TLS-PG] p.16
Upload an image from the host to the printer. See [TLS-PG] p.17
Arguments
"A" for ASCII, "B" for binaryEnable extended system commands. See [TLS-PG] p.18
Enter label formatting mode. See "Label formatting commands". See [TLS-PG] p.18
Set the printer to use the metric system for measurements. See [TLS-PG] p.18
Set the printer to use the imperial system for measurements. See [TLS-PG] p.19
Adjust the point where printing starts, relative to the top-of-form position. See [TLS-PG] p.19
Arguments
Adjust the point where printing starts, relative to the left edge of the label. See [TLS-PG] p.20
Arguments
Set the label length for continuous material. See [TLS-PG] p.20
Arguments
Instruct the printer to clear all images from memory. See [TLS-PG] p.21
Set the label spacing for continuous material. See [TLS-PG] p.21
Arguments
Instruct the printer to print a dot pattern test label. See [TLS-PG] p.22
Fetch and return the touch cell data from the media as binary. See [TLS-PG] p.22
Returns
Place new data into format fields. See [TLS-PG] p.24
Arguments
Fetch and return the touch cell data from the media as ASCII. See [TLS-PG] p.25
Returns
Example
my ($rc, $raw, %stat) = $device->sc_get_touch_cell_data_ascii
Fetch and return the firmware version. See [TLS-PG] p.25
Fetch and return a directory listing of images in printer memory. See [TLS-PG] p.25
Instruct the printer to remove a specific file from memory. See [TLS-PG] p.26
Arguments
"G" for imageInstruct the printer to reclaim all storage space associated with deleted files. See [TLS-PG] p.27
See [TLS-PG] p.30
Arguments
See [TLS-PG] p.31
Arguments
See [TLS-PG] p.31
See [TLS-PG] p.31
Arguments
See [TLS-PG] p.32
See [TLS-PG] p.33
Arguments
See [TLS-PG] p.33
Arguments
See [TLS-PG] p.34
Arguments
See [TLS-PG] p.34
Arguments
See [TLS-PG] p.35
Arguments
See [TLS-PG] p.37
Arguments
Flush the input buffers. Must typically be used when the printer is power cycled.
Transfer a label onto the printer, optionally asking for immediate printing.
See [TLS-PG] pp.29-43
Parameters
lines - (mandatory) arrayref of lines describing the labelprint_now - prints the label now if given a true value; defaults to falseReturn

Device::TLSPrinter defines the following constants.
Most system and label formatting commands return the feedback character as result code. See [TLS-PG] pp.12, 47
FC_OK - no errorFC_SERIAL_TIMEOUT_ERROR - serial timeout errorFC_COMMAND_ERROR - command errorFC_MEMORY_FULL_ERROR - memory full errorFC_IMAGE_ALREADY_EXISTS - image already exists in memory so it was not storedFC_IMMEDIATE_COMMANDS_ENABLED - immediate commands enabledFC_OUT_OF_LABELS - out of labelsFC_PRINTHEAD_OPEN - printhead openFC_OUT_OF_RIBBON - out of ribbonFC_BATTERY_CELL_SHORTED - battery cell is shortedFC_LOW_BATTERY - low batteryFC_PRINTING_COMPLETE - printing is completeFC_NO_LABEL_FORMAT_ERROR - did not print because no label format has been givenFC_MEMORY_READ_ERROR - error reading memory touch cell on mediaFC_MEDIA_CHANGED - media has changedFC_PRINTHEAD_TOO_HOT - printhead is too hotFC_LABEL_ERROR - error building labelFC_FIELD_ERROR - field errorFC_FEED_TO_CUT_COMPLETE - feed to cut completeThe following errors are specific to Device::TLSPrinter.
FC_UNDEF - default value when no feedback was available (typically for immediate commands)FC_IMMEDIATE_COMMANDS_DISABLED - confirms that immediate commands were disabledFC_NOT_IN_LABEL_EDIT_MODE - a label formatting command was requested while not in label formatting modeAvailable rotations for lc_add_field().
ROTATION_NONE - no rotationROTATION_90 - rotate by 90°ROTATION_180 - rotate by 180°ROTATION_270 - rotate by 270°Available field types for lc_add_field().
TYPE_FONT - fontTYPE_BARCODE_39 - barcode in Code 39TYPE_BARCODE_39_WITH_CHECK - barcode in Code 39 with check characterTYPE_BARCODE_128 - barcode in Code 128TYPE_IMAGE - image file
Could not load driver %s: no such module(E) The indicated driver could be be loaded. Please check the argument given to the parameter type given to new().
Invalid value for %s(E) The value passed to the indicated parameter is not valid. Please check the documentation of the corresponding function for the valid values.
Missing required parameter: %s(E) The indicated parameter is mandatory, but you didn't provide an arugment for it. Please check the documentation of the corresponding function.
You should specify the connection type(W) You didn't set the type parameter for new(). The function then tries to guess the correct type.

[TLS-PG] TLS PC Link Programmer's Guide, http://www.bradyid.com/bradyid/downloads/downloadsPageView.do?file=TLSPCLink_Prog.pdf

Please report any bugs or feature requests to bug-device-tlsprinter at rt.cpan.org, or through the web interface at https://rt.cpan.org/Dist/Display.html?Name=Device-TLSPrinter. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Device::TLSPrinter
You can also look for information at:
https://rt.cpan.org/Dist/Display.html?Name=Device-TLSPrinter

Sébastien Aperghis-Tramoni, <sebastien (at) aperghis.net>

Copyright 2006-2012 Sébastien Aperghis-Tramoni, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.