0.0.2 • Published 2 years ago

brother-escp v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

brother-escp

An NPM package to interface with Brother receipt and label printers using ESC/P.

Installation

npm install brother-escp

Example

See the examples folder for more functions.

import { Printer, Page, TextAlignment } from "brother-escp";

const page = new Page();
page
    .text("Normal text ")
    .bold(true)
    .text("Bold text ")
    .bold(false)
    .italic(true)
    .text("Italic text ")
    .bold(true)
    .text("Bold and italic text ")
    .bold(false).italic(false)
    .emptyLine()
    .characterSize(32)
    .text("Big text!")
    .characterSize(24)
    .emptyLine()
    .text("Characters: öhm äh u are β and man ☑ ¿¿ ╬ invālid")
    .emptyLine()
    .alignment(TextAlignment.Right)
    .text("Right text :D")
    .alignment(null);

const printer = await Printer.connect("ip address");
await printer.print(page);
await printer.disconnect();