• Stars
    star
    123
  • Rank 290,145 (Top 6 %)
  • Language
    JavaScript
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pure javascript library for printing labels on a Dymo Labelwriter printer from the browser or from nodejs.

dymojs

Build Status

Wicked simple pure javascript cross platform Dymo Labewriter printing module for Node.js with no platform dependencies.

This module works on Mac, Linux, and Windows.

  • no gyp build needed
  • no Microsoft Visual Studio needed.
  • no gcc or c++ build needed

install

yarn add dymojs

or if you are stuck in the old school

npm i dymojs

usage

const Dymo = require('dymojs'),
	   dymo = new Dymo();

dymo.print('DYMO LabelWriter 450', labelXml);

render a label preview

dymo.renderLabel(labelXml).then(imageData => {
	// returns imageData as base64 encoded png.
	// use <img src="data:image/png;base64,${imageData}"/>
	// or require("fs").writeFile("out.png", imageData, 'base64', function(err) {...});
});

how do I get the xml for a label?

Open the free DYMO Label software and design a label. When you have designed one save it. The file it saves is an XML document like the one below. Simply pass that XML or (hint hint) a version of that XML that you did some string replacement on to the print function with a printer name and you are printing labels.

working example that prints a test label

This example will print TEST123 on a shipping size label (2 1/8" x 4") to a printer named 'DYMO LabelWriter 450'.

const Dymo = require('dymojs'),
	   dymo = new Dymo();

dymo.print('DYMO LabelWriter 450', labelXml);

var labelXml = `
<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips">
  <PaperOrientation>Landscape</PaperOrientation>
  <Id>LargeShipping</Id>
  <PaperName>30256 Shipping</PaperName>
  <DrawCommands>
    <RoundRectangle X="0" Y="0" Width="3331" Height="5715" Rx="270" Ry="270"/>
  </DrawCommands>
  <ObjectInfo>
    <TextObject>
      <Name>TEXT</Name>
      <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
      <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>
      <LinkedObjectName></LinkedObjectName>
      <Rotation>Rotation0</Rotation>
      <IsMirrored>False</IsMirrored>
      <IsVariable>False</IsVariable>
      <HorizontalAlignment>Left</HorizontalAlignment>
      <VerticalAlignment>Middle</VerticalAlignment>
      <TextFitMode>AlwaysFit</TextFitMode>
      <UseFullFontHeight>True</UseFullFontHeight>
      <Verticalized>False</Verticalized>
      <StyledText>
        <Element>
          <String>T</String>
          <Attributes>
            <Font Family="Helvetica" Size="13" 
            	Bold="False" Italic="False" Underline="False" Strikeout="False"/>
            <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
          </Attributes>
        </Element>
        <Element>
          <String>EST123</String>
          <Attributes>
            <Font Family="Helvetica" Size="13" 
            	Bold="False" Italic="False" Underline="False" Strikeout="False"/>
            <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
          </Attributes>
        </Element>
      </StyledText>
    </TextObject>
    <Bounds X="335.9998" Y="57.6001" Width="5337.6" Height="3192"/>
  </ObjectInfo>
</DieCutLabel>
`;

More Repositories

1

fauxmojs

Fake WeMo device ported to NodeJS. Allows Alexa (Amazon Echo) to make api calls.
JavaScript
56
star
2

cdk-static-website

Deploy a SPA Website to AWS S3 with CloudFront CDN using AWS CDK
TypeScript
25
star
3

example-ws-gateway-sam

Defining WebSocket API Gateway Endpoints in a SAM Template
JavaScript
11
star
4

aws-toolbox

A collection of command line utilities to do things in AWS
JavaScript
9
star
5

pgcompare

pgCompare compares two Postgres database schemas for differences and shows what is different.
JavaScript
7
star
6

aws-webdeploy

Website deployment cli.
JavaScript
6
star
7

aws-websocket-sam-helper

This module will allow you to use json files to decorate your serverless code. Those json files will be used to generate out a valid SAM Template.
JavaScript
6
star
8

example-sns-sqs-lambda

Example project showing how to make an SNS Topic, SQS Queue, and Lambda that is triggered by a new SQS Message.
JavaScript
6
star
9

iam-extractor

Simple tool to extract a full IAM role into a YAML CloudFormation snippet.
Go
5
star
10

example-ws-api

Example code for creating an AWS API Gateway WebSocket API with Request/Response with Golang Lambda Functions.
Go
5
star
11

example-aws-s3-lambda

Example project for configuring a lambda to be triggered when a file is added to an S3 bucket.
JavaScript
4
star
12

vision

CSS
2
star
13

rn-components

A simple set of dependency free components for React Native.
JavaScript
2
star
14

example-lambda-sns

Subscribe an AWS Lambda function to an SNS Topic in CloudFormation (..and work)
JavaScript
2
star
15

example-api-authorizer

Example of an APIGW Request Authorizer.
JavaScript
1
star
16

node-session-tokens

Simple session based token authorization hooks.
JavaScript
1
star
17

SkydriveHelper

Portable class library to simplify SkyDrive access.
C#
1
star
18

flow-meter

Arduino Flow Meter to display gallons dispensed.
C++
1
star
19

example-ws-api-gateway

JavaScript
1
star