GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - node-escpos/driver: ๐Ÿ–จ๏ธ ESC/POS Printer driver for Node.js.

BranchesTags
Open more actions menu

Latest commit

 

History

163 Commits
163 Commits

Folders and files

NameName
Last commit message
Last commit date
.changeset
.changeset
 
 
.github
.github
 
 
.vscode
.vscode
 
 
examples
examples
 
 
packages
packages
 
 
test
test
 
 
.eslintrc
.eslintrc
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 

Repository files navigation

@node-escpos



๐Ÿ–จ๏ธ ESC/POS Printer driver for Node.js.


Hacktober Badge


demo.mp4

[๐Ÿ“ข RFC] Recently I'm working on a new workflow that prints the receipt. HTML+CSS will customize the content. Theoretically, we can print anything that we want. The workflow is like this:

  1. ๐ŸŽจ rendering
<div id="label-dom"> Label/Receipt </div>
  1. ๐Ÿ“ธ capturing
const screenshort = await capture(document.getElementByID("label-dom"))
  1. ๐Ÿงพ printing
const printer = await printer.image(screenshort, "s8")
printer.cut().close()

But my full-time job is very busy. So the progress is slow, And any sponsorship will encourage me to work more actively in the open-source community.


Improvements

  • ๐Ÿ›  TypeScript.
  • ๐Ÿ“ฆ pnpm.
  • ๐ŸŸข vitest.
  • ๐Ÿš€ More stable maintenance.
  • ๐Ÿ”ด Printing by HTML+CSS(WIP).
  • ๐Ÿ’ก More ideas.
  • ...

Packages

  • @node-escpos/core npm npm npm

  • @node-escpos/adapter npm npm npm

  • @node-escpos/console npm npm npm

  • @node-escpos/screen npm npm npm

  • @node-escpos/server npm npm npm

  • @node-escpos/network-adapter npm npm npm

  • @node-escpos/usb-adapter npm npm npm

  • @node-escpos/serialport-adapter npm npm npm

  • @node-escpos/bluetooth-adapter npm npm npm

Example

import { Printer, Image } from "@node-escpos/core";
// install escpos-usb adapter module manually
import USB from "@node-escpos/usb-adapter";
// Select the adapter based on your printer type
import { join } from "path";

const device = new USB();

device.open(async function(err){
  if(err){
    // handle error
    return
  }

  // encoding is optional
  const options = { encoding: "GB18030" /* default */ }
  let printer = new Printer(device, options);

  // Path to png image
  const filePath = join("/PATH/TO/IMAGE");
  const image = await Image.load(filePath);

  printer
    .font("a")
    .align("ct")
    .style("bu")
    .size(1, 1)
    .text("May the gold fill your pocket")
    .text("ๆญๅ–œๅ‘่ดข")
    .barcode(112233445566, "EAN13", { width: 50, height: 50 })
    .table(["One", "Two", "Three"])
    .tableCustom(
      [
        { text: "Left", align: "LEFT", width: 0.33, style: "B" },
        { text: "Center", align: "CENTER", width: 0.33 },
        { text: "Right", align: "RIGHT", width: 0.33 },
      ],
      { encoding: "cp857", size: [1, 1] }, // Optional
    )
    
  // inject qrimage to printer
  printer = await printer.qrimage("https://github.com/node-escpos/driver")
  // inject image to printer
  printer = await printer.image(
    image, 
    "s8" // changing with image
  )

  printer
    .cut()
    .close()
});
  • See ./examples/demo/test for more examples.

Sponsors

License

MIT License ยฉ 2022 Dohooo

About

๐Ÿ–จ๏ธ ESC/POS Printer driver for Node.js.

Topics

bluetoothdriverescposescpos-printerhacktoberfesthardwarenetworknode-escposnode-printernodejsprinterserialportthermal-printingusb

Resources

Readme
License

Contributing

Contributing
Activity
Custom properties

Stars

375 stars

Watchers

8 watching

Forks

38 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.