Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dtgreene/niimbotjs
Niimbot printer client in Node.js
https://github.com/dtgreene/niimbotjs
label-printer niimbot printer
Last synced: 9 days ago
JSON representation
Niimbot printer client in Node.js
- Host: GitHub
- URL: https://github.com/dtgreene/niimbotjs
- Owner: dtgreene
- Created: 2024-06-12T00:25:24.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-24T17:35:50.000Z (6 months ago)
- Last Synced: 2024-06-24T19:33:49.580Z (6 months ago)
- Topics: label-printer, niimbot, printer
- Language: TypeScript
- Homepage:
- Size: 87.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## NiimbotJS
A Node.js library for printing with Niimbot label printers. This project is largely a port of [kjy00302/niimprint](https://github.com/kjy00302/niimprint) and [AndBondStyle/niimprint](https://github.com/AndBondStyle/niimprint) so big thanks to them. Currently, only printing over USB is supported.
## Usage
Images are handled using the [sharp](https://sharp.pixelplumbing.com/) library. As long as your image is supported by sharp, it should work.
### CLI
The easiest way to just start printing is via npx:
```sh
npx niimbotjs my_image.png
``````
Usage: niimbot [options]Printer client for Niimbot printers over USB
Arguments:
image path of the image to printOptions:
-m, --model niimbot model (choices: "b1", "b18", "b21", "d11", "d110", default: "b1")
-d, --density print density (default: "5")
--debug enable debug logging
-p, --path serial path of the printer
-h, --help display help for command
```### Package
You can also add the package to your project and print that way:
```
npm install niimbotjs
``````js
import { PrinterClient } from 'niimbotjs';
import sharp from 'sharp';const client = new PrinterClient();
const image = sharp('my_image.png');try {
await client.open();
await client.print(image, { density: 5 });
} catch (error) {
console.error(error);
}client.close();
```Check out the [Wiki](https://github.com/dtgreene/niimbotjs/wiki) for documentation.
## Development
If you're doing your own development on the Niimbot printers, checkout [niimbotjs-tools](https://github.com/dtgreene/niimbotjs-tools)