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

printer-dymo

v1.0.3

Published

An Electron Node.js addon for interfacing with Dymo LabelWriter printers

Downloads

9

Readme

Printer Dymo

An Electron Node.js module for interacting with Dymo LabelWriter printers using the DLS SDK. This library is built and maintained by Paul Prins of Fresh Vine for their Event Kiosk.

The documentation for the SDK is located in the SDK sample file from DYMO. You can download it from here.

Installation

You will need the latest Dymo LabelWriter software installed first. This provides all of the dependent Dymo libraries.

$ npm install printer-dymo --save

Use

This impementation is still very young but is production ready.

var printerDymo = require('printer-dymo'),
	fs = require('fs');

// It takes a second or two for initialization to complete.
setTimeout(function(){

	// Gets an array of IPrinter objects (Dymo printers on the current system)
	printerDymo.getPrintersAsync(null, function(err, printers){
		if (err) throw err;
		console.log(printers);
	});

	// A print object;
	var printArgs = {
		printer: 'DYMO LabelWriter 450',	//name of printer
		jobTitle: 'My Sweet Labels',
		labels:[{
			filename: 'test.label',		//path to label
			fields: {
				name: 'Timmy',
				barcode: '100360931'
			},
			images: {
				photo: fs.readFileSync('face.png')
			}
		}]
	};

	printerDymo.print(printArgs, function(err, res){
		if (err) throw err;
		console.log("Finished Printing.");
	});

}, 2000);

getPrinter

getPrinters();

getPrintersSync();

TODO

  • [x] Test coverage
  • [x] Build instructions
  • [ ] Make use of EventEmitter and fire Ready event after initialization
  • [ ] Improve API
  • [ ] Travis CI

Building

Prerequisits:

Install Node.js. Then install gyp:

$ npm install -g node-gyp

For gyp you will also need:

Updating Dymo included DLLs

To get the DLLs to include in the project you need to install the DLS software from DYMO. The 32 bit versions are placed into the base install directory (c:\Program Files (x86)\DYMO\DYMO Label Software), and the 64 bit versions are in the x64 folder off that base directory. Beyond that there is a DYMO.Label.Framework.dll file located in the 'Framework' directory.

Whenever there is an update to the DYMO DLS we should update these libraries if there are any differences.

Including .NetFramework for Windows Deployments with Electron.json

In order for the electron-edge-js library to work correctly the client computer must have the .NetFramwork 4.5 installed. So you can either require them to install this (which will likely just lead to higher support volume to explain this), or you can include the needed library items in your build.

To include the required DLLs you should download them from microsoft - download .NetFramework 4.5. You need 4 of these libraries (concrt140.dll, msvcp140.dll, vccorlib140.dll, vcruntime140.dll). Electron Builder makes it easy to use architecture in their extraFiles (docs). The code below will grab every file in the extraLib/dotNetFramework/x64/ directory for an x64 build on windows, and place it in the application root directory. Using the dependency walker we were able to verify that the application utilized these files, instead of those on (or missing from) the client system.

{
	...
	"build": {
		...

		"files": [
			"!**/extraLib/**/*"
		],
		"win": {
			"extraFiles": [
				{
					"from": "extraLib/dotNetFramework/${arch}/",
					"to": "",
					"filter": "**/*"
				}
			]
		}
		...
	}
	...
}

We deploy to both x64 and ia32. Make sure the correctly build libraries are in the correct locations. Our paths look like:

extraLib/dotNetFramework/ia32/concrt140.dll
extraLib/dotNetFramework/ia32/msvcp140.dll
extraLib/dotNetFramework/ia32/vccorlib140.dll
extraLib/dotNetFramework/ia32/vcruntime140.dll
extraLib/dotNetFramework/x64/concrt140.dll
extraLib/dotNetFramework/x64/msvcp140.dll
extraLib/dotNetFramework/x64/vccorlib140.dll
extraLib/dotNetFramework/x64/vcruntime140.dll

These files are not included here to allow for flexibility in use. Also you may have other libraries that make use of this framework, and including it multiple times would add overhead to your project.

Publishing

npm pack
npm publish

Contributing

Fork, add unit tests for any new or changed functionality.

Lint and test your code.

Release History

  • 1.0.3 Update the DYMO DLLs to fix the printing delay introduced in April 2018, add new print parameter for quality level. Fixed the printing copies parameter (had a type conversion exception thrown).
  • 1.0.2 Update readme with better implementation instructions.
  • 1.0.1 Changed to electron-edge-js from electron-edge as it has wider support.
  • 1.0.0 Rebuilt the C# library as a shared library resource and not have Synchronous & Asynchronous functions.
    Now includes 2 missing DYMO libraries (DYMOPrinting.dll & PrintingSupportLibrary.dll) that caused errors when deployed. These are included with both x86 & x64 flavors.
  • 0.4.0 Refactored C# dymo.cs to use dynamic variables in place of object variables.
  • 0.1.0 Fix: Had default print copies set to 3 for testing that was committed.
  • 0.0.3 Printing multiple labels in a single print job.
  • 0.0.1 Initial release; Module boilerplate.