Git Product home page Git Product logo

demo-print's Introduction

填写任意页面之后,向页面注入一个打印方法,直接调用即可打印任意 html 节点。

使用

首先保证你的打印机已连接并正常可用。例如在百度上添加一个打印功能:

第一步:

https://baidu.com 填入 package.json 文件的 page 处,运行 main.exe。

第二步:

在页面中调用 tool.print() 方法,传入要打印的 html 即可。

例如:

window.tool.print(document.querySelector(`span`));

环境

当前测试过的环境如下:

  • os: win11 / win10 / win7 x64
  • node: 13.14+

打印机:

  • 厂家: Xprinter 芯烨
  • 型号: XP-58IIH 热敏小票打印机
  • 接口: USB
  • 纸宽: 58mm

开发

浏览器的代码在 preload.js 中。服务器的代码在 sys.js 中,由 nodejs 运行,主要使用了 node-escpos 实现打印功能。

exe 使用方式可参考 sys-shim

demo-print's People

Contributors

wll8 avatar

Stargazers

 avatar julei avatar  avatar

Watchers

 avatar

Forkers

cq971020745

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.