1 Star 0 Fork 50

qq910297279 / nop-printer

forked from nop / nop-printer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

用于小票打印,目前适用于Window(Windows 7、Windows 10)

是一个小票打印的Api服务,使用php的mike42/escpos-php库。
内容部包含一个独立解压版的php7.3.4,不需另行安装php环境

使用方法

安装服务

  • 下载源码的zip包
  • 解压源码包
  • 运行 quick-start.bat(打开配置页) 或 printer-start.bat(不打开配置页)

配置页(或使用下面的接口调用进行配置)

在操作之前,请先在安装好小票打印机及驱动。

1.添加打印机:选择安装的小票打印机,点击“+”号
如果列表内为空,则新添加的打印机会成为默认打印机。
注意:“虚拟打印机”是无法添加的

2.点击打印测试页,会跳转到预览页,点击右侧,打印按钮。

从接口进行配置

  • 获取所有打印机
GET http://localhost:8077/api/printer/get-local-printers
  • 配置添加的小票打印机
POST http://localhost:8077/api/printer/set-printer-config
参数:JSON
{"printer_name":"POS-58","is_default":true}
  • 设置默认打印机
POST http://localhost:8077/api/printer/set-defult-printer
参数:JSON
{"printer_name":"POS-58"}

打印小票

  • 因为各种小票打印机支持的功能差异太大,所有就只实现图片打印,市场上80%的小票打印机都支持图片。
  • 测试页就是使用html转canvas图片进行打印的
POST http://localhost:8077/api/job/print-image-data-url
参数:JSON
printer_name: 可以不传或为空,则使用默认打印机
{"printer_name":"POS-58","image_data":"data:image/png;base64,..."}

启动服务

运行:printer-start.bat

停止服务

运行:printer-stop.bat

注册系统服务启动项

运行:system-service register

注销系统服务启动项

运行:system-service unregister
MIT License Copyright (c) 2021 wuxue107 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

小票打印服务,支持Win10/Win7 集成php独立环境 Window ticket printer 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/910297279/nop-printer.git
git@gitee.com:910297279/nop-printer.git
910297279
nop-printer
nop-printer
master

搜索帮助