Device::TLSPrinter - Module for using a TLS barcode printer
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.
type- specify the type of connection, either
device- (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.
cmd- (mandatory) command string to send
expect- if the command expects an answer, indicate the number of characters to read
Returns 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
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
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
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
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
Enable 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
Adjust the point where printing starts, relative to the left edge of the label. See [TLS-PG] p.20
Set the label length for continuous material. See [TLS-PG] p.20
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
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
Place new data into format fields. See [TLS-PG] p.24
Fetch and return the touch cell data from the media as ASCII. See [TLS-PG] p.25
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
Instruct the printer to reclaim all storage space associated with deleted files. See [TLS-PG] p.27
See [TLS-PG] p.30
See [TLS-PG] p.31
See [TLS-PG] p.31
See [TLS-PG] p.31
See [TLS-PG] p.32
See [TLS-PG] p.33
See [TLS-PG] p.33
See [TLS-PG] p.34
See [TLS-PG] p.34
See [TLS-PG] p.35
See [TLS-PG] p.37
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
lines- (mandatory) arrayref of lines describing the label
print_now- prints the label now if given a true value; defaults to false
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 error
FC_SERIAL_TIMEOUT_ERROR- serial timeout error
FC_COMMAND_ERROR- command error
FC_MEMORY_FULL_ERROR- memory full error
FC_IMAGE_ALREADY_EXISTS- image already exists in memory so it was not stored
FC_IMMEDIATE_COMMANDS_ENABLED- immediate commands enabled
FC_OUT_OF_LABELS- out of labels
FC_PRINTHEAD_OPEN- printhead open
FC_OUT_OF_RIBBON- out of ribbon
FC_BATTERY_CELL_SHORTED- battery cell is shorted
FC_LOW_BATTERY- low battery
FC_PRINTING_COMPLETE- printing is complete
FC_NO_LABEL_FORMAT_ERROR- did not print because no label format has been given
FC_MEMORY_READ_ERROR- error reading memory touch cell on media
FC_MEDIA_CHANGED- media has changed
FC_PRINTHEAD_TOO_HOT- printhead is too hot
FC_LABEL_ERROR- error building label
FC_FIELD_ERROR- field error
FC_FEED_TO_CUT_COMPLETE- feed to cut complete
The following errors are specific to
FC_UNDEF- default value when no feedback was available (typically for immediate commands)
FC_IMMEDIATE_COMMANDS_DISABLED- confirms that immediate commands were disabled
FC_NOT_IN_LABEL_EDIT_MODE- a label formatting command was requested while not in label formatting mode
Available rotations for
ROTATION_NONE- no rotation
ROTATION_90- rotate by 90°
ROTATION_180- rotate by 180°
ROTATION_270- rotate by 270°
Available field types for
TYPE_BARCODE_39- barcode in Code 39
TYPE_BARCODE_39_WITH_CHECK- barcode in Code 39 with check character
TYPE_BARCODE_128- barcode in Code 128
TYPE_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
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.
You can also look for information at:
<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.