Oct 072011

A new version of DYMO Label Framework JavaScript library is available.

This version adds support for Opera 11.51 on Mac and Windows.

The js script file is available from http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.2.4.js.

The http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js has been updated to version 1.2.4 as well.

Oct 042011

There are two ways of providing dynamic text data to be printed on your labels. In both cases the text can be “styled”, so different parts of the text will use different fonts, sizes and/or styles.

The first way covers most use cases for text formatting needs, it is simple, and, of cause, has some limitations. The limitation is that it supports line-by-line formatting only. So, each line can have its own formatting, but all characters in the same line will use the same formatting. If this is OK for your application, then here are the steps needed to utilize this method. first, you have to design you label layout/template. The easiest way to design a label is by using DYMO Label software. While designing, type a sample data for a label object, and apply some formatting, on line by line basis, e.g. make the first line bold, save the file, and put it on your server. 


Those are manual steps, now we will need some JavaScript. Load the label by using openLabelXml. Now you can set your real data by using setLabelText or, if you need to print multiple labels, by using a LabelSet. You pass a plain string without any formatting to the setLabelText method, and the library will apply line-by-line formatting for you based on the sample data in the label file. For example, if you call setLabelText(‘Will E. CoyotenACME Birdingn2200 Desert Meadows WaynLas Vegas, NV 89122’), the output will be like that:


The second way to format the text is by using so called “Text Markup” feature. It is some what more complex than the first formatting method, but in return you have the full control over the font attributes and can do character-by-character formatting. First, you design your label as described above, but you don’t have to specify any sample data. Next you have to construct a “text markup”.  A text markup is an xml string contains tags controlling font attributes, plus plain text data. The Supported tags are ones similar to HTML tags: <font>, <b>, <i>, <u>, <s>, <br>. Full xml-schema definition is available here. After you have the markup text, you can print it by using a LabelSet and setTextMarkup method.

var labelSet = new dymo.label.framework.LabelSetBuilder();
var record = labelSet.addRecord();

var textMarkup = '...';
record.setTextMarkup('Text', textMarkup);
label.print('DYMO LabelWriter 450', null, labelSet.toString());

Here is an example demonstrates different formatting capabilities: http://labelwriter.com/software/dls/sdk/samples/js/TextMarkup/TextMarkup.html, and the corresponded JavaScript http://labelwriter.com/software/dls/sdk/samples/js/TextMarkup/TextMarkup.js. Type anything into the “Text to Print” text box and click on any button below. The output should correspond to the button’s caption. The corresponded text markup will be copied to the “Text Markup” text box, so you can examine it without going into JavaScript debugger. Also, you can just type any text markup in the box and print it by clicking on “Print text markup” button. Just make sure it is a correct xml and correct markup. If it is not, a runtime error/exception is thrown.

Sep 162011

A new version of DYMO Label Framework JavaScript library is available.

This version improves detection of supported browsers, or more precise unsupported ones. There is a known problem with Safari 5.1 running in 32-bit mode on both Mac OS X 10.6 and 10.7. Before version 1.2.3 the library did not detect this problem. Now, the call to dymo.label.framework.checkEnvironment() will return an error.

The js script file is available from http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.2.3.js.

The http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js has been updated to version 1.2.3 as well.

Sep 072011

A new version of DYMO Label Framework JavaScript library is available.

Thanks to our friends at lambslist.com a subtle bug in Mac version of DYMO Label software has been discovered (and fixed). The problem manifests itself at print time, when the label data is printed using the default font instead of one specified in the label file. The fix for DYMO Label software is scheduled for the next release, 8.4. In the meantime the js script library has been updated to include a workaround for the problem.

The js script file is available from http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.2.2.js.

The http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js has been updated to version 1.2.2 as well.

Jul 272011

A new version of DYMO Label Framework JavaScript library is available. This version adds support for Mac OS X 10.7 (Lion).

The js script file is available from http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.2.0.js.

The http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js has been updated to version 1.2.0 as well.

All major browsers are supported: Safari 4-5.1, Firefox 3-5, Chrome, Opera 10. Opera 11 is not supported at the time of writing.

Jul 202011

Update: A subtle bug has been found in the version 1.1.0. It is fixed now and new version 1.1.1 is available.

A new version of DYMO Label Framework JavaScript library is available. This version fixes a problem with setting a label data from Internet Explorer 9. The js script file is available from http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.1.1.js

The http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js has been updated to version 1.1.1 as well.

Jun 112010

An earlier post showed how simple is to add label printing capabilities into a web application by using DYMO Label Framework JavaScript Library. Now we will explore some advanced features. One such feature is generating a label preview. The complete sample is available on http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.html; JavaScript code on http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.js. The sample allows previewing an Address label loaded from the server. The content of the address can be edited in a TextArea element. The label preview is dynamically updated using data from the TextArea element. After the address is entered, the label can be printed on a printer selected from a list of available printers.

Loading the Label

Label layout information is stored using xml, so it is simple to operate it in the browser. The sample uses the jQuery library to load xml from the server though any other library can be used to do that. On the server the label is stored as a regular file “Address.label”.

function loadLabelFromWeb()
    // use jQuery API to load label
    $.get("Address.label", function(labelXml)
        label = dymo.label.framework.openLabelXml(labelXml);
        // check that label has an address object
        if (label.getAddressObjectCount() == 0)
            alert("Selected label does not have an address object on it. Select another label");

        addressTextArea.value = getAddress();
        printButton.disabled = false;
        addressTextArea.disabled = false;
    }, "text");

After label xml is downloaded from the server it is “opened” and stored in label variable by calling dymo.label.framework.openLabelXml() function.

Generating Preview

After the label is loaded its preview is generated by calling render() method. render() method returns preview data as a base64-encoded png stream, so it can be used as a data url for <img>.

function updatePreview()
    if (!label)

    var pngData = label.render();

    var labelImage = document.getElementById('labelImage');
    labelImage.src = "data:image/png;base64," + pngData;

Please note that not all browsers support data urls, e.g. IE6 and IE7 do not support them at all, IE8 has a limitation of 32 Kb for an url, so not all labels can fit into this limit. But it is always possible to generate preview on the server if needed.

Getting Address Data

To initialize TextArea element with address information from the label the getAddressText() method can be used. Because we know/assume that our label has only one address object on it we address it as an object with index ‘0’.

function getAddress()
    if (!label || label.getAddressObjectCount() == 0)
        return "";

    return label.getAddressText(0);

Setting Address Data

To update the label with a new address entered in TextArea element. setAddressText() can be used.

function setAddress(address)
    if (!label || label.getAddressObjectCount() == 0)

    return label.setAddressText(0, address);


Printing is as simple as calling the print() method with the printer name selected from printers combo box.



In this post we looked at how label previewing can be added into your web application. In the next post we will see how multiple labels can be printed.

Jun 022010

This blog post will show how easy is to add label printing capabilities to your web application. This is possible because of the JavaScript library that is a part of new DYMO Label Framework.


To be able to use the library DYMO Label software should be installed on the client machines. On Windows version 8.3 or later is required.  Version is available on http://download.dymo.com/download/Win/DLS8Setup. On Mac version or later is required. Version is available on http://www.labelwriter.com/software/dls/mac/DLS8Setup.

The Sample

The complete sample is available on http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html

The code in the sample is in http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.js

The sample is minimalistic. It just contains a text area element to specify a text to be printed on a label and a button that triggers printing.


The first thing should be done for any web project that uses the Framework is to include the library’s code, so it is available for scripts on the page. It is done like this:

<script src="http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js"
        type="text/javascript" charset="UTF-8"> </script>

This will include the latest version of the library. The only other hosted version for now is http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.0.beta.js

In the future other versions will be available as well. It is OK to host the file on your own web-server.

Print a Label

All printing code is in the printButton.onclick event handler assigned in PrintLabel.js. The print task contains three major steps: specifying label layout to print, setting data to print, selecting printer to print on, and actual printing.

Specify Label Layout to Print

Before a label can be printed we should specify what is the label, what objects it contains, what are their positions, etc. It is done by “opening” a label. The easiest way is to put the xml string describing the label right into openLabelXml() function. The easiest way to obtain the xml is to design the label using DYMO Label software, saving it into a file, then pasting file content into the js code.

var labelXml = '
 <DieCutLabel Version="8.0" Units="twips">
 <PaperName>30252 Address</PaperName>
 <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
 <BackColor Alpha="0" Red="255" Green="255" Blue="255" />
 <Bounds X="332" Y="150" Width="4455" Height="1260" />
var label = dymo.label.framework.openLabelXml(labelXml);

In a real web application you would probably load the label definition xml from the server using some AJAX library instead of specifying it directly in a js file.

Setting Data to Print

The next step is to specify data to print on the label. This is easy:

label.setObjectText("Text", textTextArea.value);

The code sets the content for the object named “Text” to whatever is typed in the text area field on the page. Note: the library supports setting formatted/styled text as well. This ability will be reviewed in a different blog post.

Selecting the Printer to Print on

The printer should be selected from a list of installed printers. For this sample we choose the first LabelWriter printer:

var printers = dymo.label.framework.getPrinters();
if (printers.length == 0)
    throw "No DYMO printers are installed. Install DYMO printers.";

var printerName = "";
for (var i = 0; i < printers.length; ++i)
    var printer = printers[i];
    if (printer.printerType == "LabelWriterPrinter")
        printerName = printer.name;

Actual Printing

If the printer name is known the printing is simple:



As you can see, label printing is not hard if DYMO Label Framework is being used. The Framework has a lot of other useful features, like multiple label printing, specifying image data for a label, specifying text styles, etc. These features will be reviewed in later posts.

May 252010

Update: DYMO Label software 8.3 has been released. See http://developers.dymo.com/2011/01/13/announcing-dymo-label-8-3/

Update 2: DYMO Label SDK 8.3.1 has been released. See http://developers.dymo.com/2011/12/02/announcing-dymo-label-sdk-8-3-1/

Please Note

This release is a BETA. It has not been extensively tested outside DYMO and should be used for developer testing only, NOT for production software releases.

What’s New

64-bit Support

Now you can use the SDK from 64-bit processes, e.g. Internet Explorer 64-bit. The only thing to do is to recompile your application to be 64-bit, no need to change any code.

New DYMO Label Framework API

Starting this introduces a new API – the DYMO Label Framework. It provides a simpler streamlined interface for printing labels.

Major Features

  • Support for 32-bit and 64-bit applications.
  • Support for Tape printers. Now you can use the same simple API to print on Tape printers as for printing on LabelWriter printers. All you need to do is to design a Tape label in DLS, load it in your application and print.
  • Native .NET support. The Framework provides native .NET support. There is no need to use COM-Interop anymore. Features available in .NET such as indexed properties, enumerators, etc are used to provide an API that is easier to use.
  • COM support. Microsoft COM is supported as well, similar to current SDK.
  • Consolidated High and Low Level API. The Framework combines the current high-level and low-level APIs into a single API. Now there is no need to switch between APIs if you need some advanced functionality not available in high-level API.
  • Cross-browser and cross-platform JavaScript library – see below.

DYMO Label Framework JavaScript Library

To simplify using DYMO Label SDK from web-based application we created a JavaScript library that abstracts browser and platform details for accessing DLS SDK from JavaScript. Now you can use the same JavaScript code to add printing support for any browser the SDK supports. Currently supported browsers are:

  • On Windows: Internet Explorer 6+, Firefox 2+, Chrome 4, Opera 10, Safari
  • On Mac: Safari 3+

Major Features

  • Simple cross-browser and cross-platform API
  • Ability to load and print a label from: a web server, the local file system, or construct on the fly in JavaScript
  • Ability to load images from the server or from local file system
  • Ability to print multiple labels at once

Samples are available on “DYMO Label Framework/Samples/JavaScript” subfolder of the root SDK installation folder. Extensive documentation is provided at the top of the DYMO.Label.Framework.js file.

SDK Installation

The SDK libraries are installed by the DYMO Label 8.2.3 installer. It installs BOTH the DLS SDK (32 and 64 bit) and the new DYMO Label Framework along with drivers and the DYMO Label application.

Windows DYMO Label v.8 Installer



SDK Installer (Documentation and Samples)