npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-excelvan

v0.2.3

Published

A nodejs library to manipulate ExcelVan ESC/POS printers.

Downloads

7

Readme

node-excelvan

A nodejs library to interact with the Excelvan (and possibly other) escpos printer over usb.

Getting started

Install dependencies:

  • Windows: Install Zagig then install a driver for the printer
  • Linux: Run sudo apt-get install libudev-dev

Install the module npm install --save node-excelvan

Plug in the printer.

const { Printer, PrintJob } = require( 'node-excelvan' );

let myPrinter = new Printer(); // Optionally pass in the manufacturer & vendor ID(s)
let myPrintJob = new PrintJob();

myPrinter.connect(); // Optionally specify manufacturer and vendor ID(s) here too

myPrintJob.text('hello, printed world!'); // Add some plain text to the output

myPrinter.print(myPrintJob); // Send the job to the printer

Usage

const { Printer, PrintJob } = require( 'node-excelvan' );

let myPrinter = new Printer();
let myPrintJob = new PrintJob();

myPrinter.connect();


// Make a pretty page...
myPrintJob.pad( 1 ); // add some padding
myPrintJob.text( 'This is line 1' ); // add some text

myPrintJob.setTextAlignment( 'center' ); // change the text alignment
myPrintJob.separator(); // draw a horizontal line

myPrintJob.setTextAlignment( 'right' );
myPrintJob.text( 'This is line 2' );

myPrintJob.setTextAlignment( 'center' );
myPrintJob.separator();

myPrintJob.text( 'And line 3' );

myPrintJob.pad( 1 );
myPrintJob.cut(); // slice dat.

// Send the printJob to the printer
myPrinter.print( myPrintJob, function () {
	console.log( "It's finished printing!!" );
} );

PrintJob

text

param: text { String } The text to print

adds plain text to the output

newLine

param: count { Number } How many new lines to print

prints a newline character

pad

param: count { Number } How much white-space (in vertical units)

adds vertical white-space

setTextFormat

param: format { String } The format to set

(coming soon) set various aspects of font

setFont

param: font { String } The font to use. Either 'A' or 'B'

choose font A or font B

setBold#

param: enabled { Boolean } Whether to turn bold on or off

set bold to true/false

setUnderline

param: enabled { Boolean } Whether to turn underline on or off

set underline to true/false

setTextAlignment

param: alignment { String } What to set the text alignment to

sets text alignment to 'left', 'center' or 'right'

separator

print horizontal line

cut

cuts paper

Printer

connect

param: manufacturerId { String } The usb device's manufacturer ID

param: vendorId { String } The usb device's vendor ID

param: callback { Function } called on completion

establishes a connection to the printer, taking control from the OS

disconnect

param: callback { Function } called on completion

returns control of the printer to the OS and closes the connection to it

print

param: printJob { Object:PrintJob } The job to print

param: callback { Function } called on completion

sends the commands in the printJob

License

MIT

Thanks

The python-escpos team - for creating the original, Python version

@StaduimRunner - for their great work creating a nodejs version