tspl2-driver
============
This library will help you to communicate with TSPL2 (by TSC) based printers.
This drivers supports communication with printer over
* USB Communication
* Ethernet
* Bluetooth (TODO)
> **Disclaimer:** This is not official or supported by TSC Auto ID Technology Co., Ltd.
> This work is originated purely because there are no equivalent libraries exists for java to communicate to TSPL based printers.
How to use
=================
[![Maven Central](https://img.shields.io/maven-central/v/org.fintrace.core.drivers/tspl2-driver.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22org.fintrace.core.drivers%22%20AND%20a:%22tspl2-driver%22)
Add dependency in your pom
```xml
<dependency>
<groupId>org.fintrace.core.drivers</groupId>
<artifactId>tspl2-driver</artifactId>
<version>0.0.12</version>
</dependency>
```
Create a connection client
```java
// USB Client
TSPLConnectionClient tsplConnectionClient = new USBConnectionClient(
(short) xxxx, 16), // vendor id of TSPL2 based printer
(short) xxxx, 16)); // product id of TSPL2 based printer
// Or Ethernet Client
TSPLConnectionClient tsplConnectionClient = new EthernetConnectionClient("x.x.x.x", 9100);
```
Initialize the printer with defaults
```java
tsplConnectionClient.init();
```
Once initialized, Establish the connection
```java
tsplConnectionClient.connect();
```
You may use any available device config command to overwrite the printer defaults.
Once the connection is established, Either construct the label (using fluent API) or send the plain TSPL string to print the label.
```java
TSPLLabel tsplLabel = TSPLLabel.builder()
.element(Size.builder().labelWidth(4f).labelLength(3f).build())
.element(Gap.builder().labelDistance(0f).labelOffsetDistance(0f).build())
.element(Direction.builder().printPositionAsFeed(Boolean.TRUE).build())
.element(ClearBuffer.builder().build())
.element(DataMatrix.builder().xCoordinate(10).yCoordinate(110).width(400)
.height(400).content("DMATRIX EXAMPLE 1").build())
.element(DataMatrix.builder().xCoordinate(310).yCoordinate(110).width(400)
.height(400).moduleSize(6).content("DMATRIX EXAMPLE 2").build())
.element(DataMatrix.builder().xCoordinate(10).yCoordinate(310).width(400)
.height(400).moduleSize(8).nbRows(18).nbCols(18)
.content("DMATRIX EXAMPLE 3").build())
.element(Print.builder().nbLabels(1).nbCopies(1).build())
.build();
tsplConnectionClient.send(tsplLabel);
```
The above will send the following TSPL2 code to printer
```text
SIZE 4,3
GAP 0,0
DIRECTION 1
CLS
DMATRIX 10,110,400,400, "DMATRIX EXAMPLE 1"
DMATRIX 310,110,400,400,x6, "DMATRIX EXAMPLE 2"
DMATRIX 10,310,400,400,x8,18,18, "DMATRIX EXAMPLE 3"
PRINT 1,1
```
Additionally, You may use any available status poll commands to get the status of the printer. In order to get the
status, you need to register the data listener so that the poll commands sends the result to listener.
```java
tsplConnectionClient.send(TSPLStatusPollCommands.STATUS.getCommand());
```
To disconnect and shutdown
```java
tsplConnectionClient.disconnect();
tsplConnectionClient.shutdown();
```
This library also has a nice listener pattern to receive notifications
for Data and Network.
Implement [DataListener](src/main/java/org/fintrace/core/drivers/tspl/listeners/DataListener.java) to listen for data related events from printer.
Implement [ClientListener](src/main/java/org/fintrace/core/drivers/tspl/listeners/ClientListener.java) to listen for the network related events.
Other documentation
=================
Documentation about TSPL could be find here
http://www.tscprinters.com/cms/upload/download_en/TSPL_TSPL2_Programming.pdf
or
http://mediaform.de/fileadmin/support/handbuecher/Armilla/Handbuecher/TSC_TSPL_TSPL2_Programming.pdf
Contributions
=================
Contributions of any type are welcome. Please contact via issues to discuss further.
没有合适的资源?快使用搜索试试~ 我知道了~
Java 客户端与支持 TSPL2 的标签打印机进行通信(通过 TSC)_java_代码_下载
共91个文件
java:75个
xml:4个
yml:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 83 浏览量
2022-06-22
16:20:45
上传
评论
收藏 121KB ZIP 举报
温馨提示
该库将帮助您与基于 TSPL2(通过 TSC)的打印机进行通信。 此驱动程序支持与打印机的通信 USB 通讯 以太网 蓝牙(待办事项)
资源推荐
资源详情
资源评论
收起资源包目录
tspl2-driver-master.zip (91个子文件)
tspl2-driver-master
pom.xml 14KB
.github
settings.xml 437B
workflows
build.yml 956B
release.yml 1KB
pr-title-checker-config.json 281B
CODEOWNERS 12B
license-metadata.txt 564B
checkstyle.xml 5KB
_config.yml 26B
LICENSE 11KB
CONTRIBUTING.md 1KB
src
test
resources
logback-test.xml 591B
java
org
fintrace
core
drivers
tspl
test
commands
system
PrinterInfoTest.java 2KB
CutTest.java 1KB
label
BarTest.java 3KB
AztecBarcodeTest.java 1KB
QRCodeTest.java 3KB
CodaBlockFTest.java 2KB
TSPLLabelTest.java 6KB
PDF417Test.java 7KB
BarcodeTest.java 3KB
TLC39Test.java 3KB
MaxiCodeTest.java 7KB
EraseTest.java 1KB
device
CounterTest.java 2KB
TcpServerMock.java 7KB
connection
EthernetConnectionClientTest.java 4KB
main
resources
javax.usb.properties 49B
java
org
fintrace
core
drivers
tspl
commands
status
TSPLStatusPollCommands.java 6KB
system
Gap.java 3KB
PrinterInfoPage.java 1KB
Speed.java 2KB
Print.java 2KB
SystemCommand.java 1KB
Direction.java 2KB
Density.java 2KB
MeasurementSystem.java 908B
Size.java 3KB
PrinterInfo.java 2KB
ClearBuffer.java 1KB
Cut.java 1KB
FeedOffset.java 2KB
TSPLCommand.java 860B
values
PartialCutterValues.java 1KB
PeelCommandValues.java 1KB
BackCommandValues.java 1KB
EncoderCommandValues.java 1KB
HeadCommandValues.java 1KB
CommandValues.java 897B
label
Ellipse.java 3KB
Bar.java 3KB
CodaBlockF.java 3KB
BarcodeHRCAlignment.java 1KB
BarcodeType.java 4KB
ErrorCorrectionLevel.java 886B
BarcodeRotation.java 1KB
TSPLLabel.java 1KB
Text.java 7KB
Barcode.java 14KB
AztecBarcode.java 5KB
LabelFormatCommand.java 1KB
QREncodeMode.java 813B
QRMask.java 806B
DataMatrix.java 6KB
BarcodeAlignment.java 1KB
Circle.java 3KB
TSPLLabelUtils.java 2KB
MaxiCode.java 5KB
Erase.java 3KB
QRModel.java 883B
QRCode.java 7KB
Box.java 3KB
TLC39.java 5KB
PDF417.java 7KB
device
DeviceConfigCommand.java 3KB
CounterExpression.java 2KB
Counter.java 3KB
TSPLDeviceConfigurationCommands.java 4KB
listeners
DataListener.java 2KB
ClientListener.java 2KB
exceptions
PrinterException.java 1KB
ConnectionClientException.java 2KB
LabelParserException.java 1KB
DriverConstants.java 2KB
connection
AbstractConnectionClient.java 6KB
USBConnectionClient.java 9KB
TSPLConnectionClient.java 4KB
EthernetConnectionClient.java 8KB
.gitignore 2KB
CHANGELOG.md 493B
README.md 4KB
共 91 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 农村信用社联合社计算机信息系统投产与变更管理办.docx
- 农村信用社联合社计算机信息系统数据管理办法.docx
- 利用SPSS作临床效度分析线上计算网站介绍-医学研究部统计谘.(医学PPT课件).ppt
- 利用Zabbix监控mysqldump定时备份数据库状态.docx
- 利用计算机解决问题的基本过程.doc
- 化工铁路通信工程总结.doc
- 北京大学网络教育软件工程作业.docx
- 医药公司(连锁店)计算机操作规程未新系统的自行按照旧制修改-新系统过制的编号加修模版.doc
- 医药公司(连锁店)计算机系统操作规程模版.doc
- 医药连锁门店计算机系统的操作和管理程序未新系统的自行按照旧制修改-新系统过制的编号加修模版.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功