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

godex-printer

v1.2.0

Published

Node module for sending commands to GoDex label printers.

Downloads

14

Readme

godex-printer

Sends EZPL print commands to GoDex label printer via serial port. Uses SVG as template for labels. For more information on GoDex's EZPL go here.


Installation

npm install godex-printer

Quick Start

// Import necessary modules
import {Printer, Label} from 'godex-printer';

var printer = new Printer({port:'COM4'}); // Create a new printer

// All units are in mm
var label1 = new Label({width: 80, height: 52}); // Create a new label.
label1.addRect(0,0,73.5,49,0.1);
label1.addLineHor(0, 73.5, 24, 0.2);
label1.addLineVer(35, 24, 49, 0.2);
label1.addText("Part Number", 2, 1, 2);
label1.addText("LREM2019", 1, 4, 10);
label1.addBarcode('CODE39', 2, 14, 0.2, 0.75, 8, "7dds18891");
label1.addText("QTY (PCS)", 2, 25, 2);
label1.addText("19", 2, 28, 6);
label1.addText("BIN", 36, 25, 2);
label1.addText("Tray", 36, 28, 6);

// Deprecated -> printer.addPrintTask(label1.getPrintCommand());
printer.printLabel(label1);

printer.on("printQueueEmpty", function(){
   console.log("Everything printed");
   printer.stop();
});

Note: All units are in dots (dot as in dpi. For 203 dpi printer 1mm = 8 dots)


Label template in SVG

import {Printer, SvgLabel} from 'godex-printer';

var printer = new Printer();
printer.start('COM4')
.then(function(){
   var svgLabel = new SvgLabel(__dirname+'/L01.svg', {'PartNo':7188, 'uom': 'pcs', 'Qty': 122, 'Bin': 'BXR109'});
   // Deprecated -> printer.addPrintTask(svgLabel.getPrintCommand());
   printer.printLabel(svgLabel);
   printer.on("printQueueEmpty", function(){
      console.log("Everything printed");
      printer.stop();
   });
});

SVG template file contains:

<svg width="80mm" height="52mm" style="border: 1px solid #CCC" data-template-name="test" labelGap="2" leftMargin= "26" rowOffset= "-15" startPos= "20">
   <!-- Rectangle -->
   <rect x="0mm" y="0mm" width="73.5mm" height="49mm" style="stroke: #000000; fill: none;" stroke-width="0.5mm" />
   <!-- Line -->
   <line x1="0mm" y1="24mm" x2="73.5mm" y2="24mm" stroke="red" stroke-width="0.2mm" fill="none" />
   <!-- Line -->
   <line x1="35mm" y1="24mm" x2="35mm" y2="49mm" stroke="red" stroke-width="0.2mm" fill="none" />
   <text x="2mm" y="3mm" font-size= "2mm">PART NUMBER</text>
   <text x="2mm" y="10mm" font-size= "6mm">{PartNo}</text>
   <text x="2mm" y="22mm" font-size= "8mm" data-barcode-type='CODE39'>#BA#-PartNo</text>
   <text x="2mm" y="27mm" font-size= "2mm">QTY ({uom})</text>
   <text x="2mm" y="34mm" font-size= "6mm">{Qty}</text>
   <text x="36mm" y="27mm" font-size= "2mm">BIN</text>
   <text x="36mm" y="34mm" font-size= "6mm">{Bin}</text>
   <text x="55mm" y="45mm" font-size= "2mm">#DATE#</text>
</svg>

Note: All units in SVG must be in mm (For 203 dpi printer 1mm = 8 dots). Exceptions are: leftMargin, rowOffset and startPos which are in dots.


Label Properties

| Property | Description | Default Value | | ------- | ---------------- | ---------------- | | speed | Print speed | 4 | | darkness | Print ink darkness | 26 | | roate | Label rotation | 150 | | leftMargin | Margin to leave from left of lable | 26 | | rowOffset | Margin to leave from top of label | -15 | | width | Width of label | 80 (in mm) | | length | Length of label | 52 (in mm) | | Gap | Gap between labels | 2 (in mm) | | startPos | Label feed position after printing | 20 | | copies | Number of copies of a label to print | 1 |


License

MIT