dymodev

Dec 022011
 

We are proud to announce the release of DYMO Label SDK 8.3.1. This release contains updated documentation and samples, especially for the new DYMO Label Framework API. The SDK installer is available from here.

Note: do not forget to install DYMO Label software, it is required to run any application that uses the SDK. For more information see this blog post.

Online documentation:

DYMO Label Framework .NET Reference documentation

DYMO Label JavaScript Library documentation

Nov 292011
 

This blog post will demonstrate how it is easy to print a label with a QR-code barcode from any .NET application. Even more, it will show how to do that in two different ways. The sample VS 2008 project is available here.

Prerequisites

First, make sure the latest DYMO Label software is installed. It is always available on DYMO web-site, at the time of writing it is version 8.3.1. Next, in Visual Studio create a new .NET project and add a reference to DYMO.Label.Framework assembly. This will make possible to use DYMO Label Framework API in the project.

Use Barcode Object

The easiest way to print QR-code is to use built-in support for QR-code in DYMO Label Framework. First, design your label using DYMO Label software. Unfortunately, DYMO Label itself does not have ability to specify QR-code barcode type in the UI yet. So, add the Barcode object to the label and put it into desired position. Don’t specify the barcode symbology, use the default Code39. Save the label in to a file, open the file in any XML editor and change the <Type> tag to “QRCode”.

<BarcodeObject>
    <Name>Barcode</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>
    <Text></Text>
    <Type>QRCode</Type>
    <Size>Large</Size>
    <TextPosition>None</TextPosition>
    <TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
    <CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
    <TextEmbedding>None</TextEmbedding>
    <ECLevel>0</ECLevel>
    <HorizontalAlignment>Left</HorizontalAlignment>
    <QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
</BarcodeObject>

See Barcode.label file in the sample project. After the label is ready, the actual steps to print it is quite easy: open the label, set desired data, print. Here is a snippet from the sample:

private void PrintBarcodeButton_Click(object sender, RoutedEventArgs e)
{
    // load label template
    var label = DYMO.Label.Framework.Label.Open(
        Application.GetResourceStream(
            new Uri("Barcode.label", UriKind.Relative)).Stream);

    // set barcode data
    label.SetObjectText("Barcode", "http://developers.dymo.com");

    // print
    label.Print(PrintersComboBox.Text);
}

First, label is loaded from a file, stored as a resource in the application assembly. Next, the barcode data is set to be the blog’s URL. And finally, the label is printed on the printer selected in the UI.

Use Image Object

Printing QR-code by using Barcode object is easy. The only drawback, it is hard to control the actual barcode size. <Size> tag can be used for that but it support only three predefined sizes Small/Medium/Large, but still the overall size will depend on the actual barcode data. The longer the data string, the larger is the barcode. So, the idea is to use some library to generate QR-code image of desired size, and then print it using the Image object. As before, design a label using DYMO Label software. Put an Image object on the label where the barcode should be printed. Set the Image’s Scale Mode to None to avoid image scaling and possible problems with the scanning/reading of the printed barcode. See BarcodeAsImage.label from the sample project. Then use selected library to generate the QR-code image. When specifying the barcode image size in pixels calculate it based on the printer resolution, that is 300 dpi for LabelWriter printers and 180 dpi for Tape printers. For example, if you want the barcode to be 1” in size, specify the barcode image size as 300×300 pixels. Actuals API calls are very similar to the first case.

private void PrintBarcodeAsImageButton_Click(object sender, RoutedEventArgs e)
{
    // load label template
    var label = DYMO.Label.Framework.Label.Open(
        Application.GetResourceStream(
            new Uri("BarcodeAsImage.label", UriKind.Relative)).Stream);

    // set data as a barcode image
    var imageStream = Application.GetResourceStream(
            new Uri("qr.png", UriKind.Relative)).Stream;

    label.SetImagePngData("Image", imageStream);

    // print
    label.Print(PrintersComboBox.Text);
}

First, label is loaded from a file, stored as a resource in the application assembly. Next, the barcode image is “generated”; for the simplicity, already created png file is used instead of library calls. Next, the image data is assigned to the Image object. And finally, the label is printed on the printer selected in the UI.

Conclusion

It is quite simple to print QR-code barcode even if built-in support is somewhat limited. The next post will show how to do the same thing by using DYMO Label JavaScript library.

Nov 172011
 

Here is one more sample demonstrates capabilities of DYMO Label JavaScript library. The correspondent JavaScript file is here.

Getting Printers

First, the sample shows how to retrieve a list of available DYMO printers. For each printer it shows all the available properties. To get the printer list use dymo.label.framework.getPrinters function. The function returns an array contains information regarding each printer. The sample calls getPrinters and then put all the information onto a table, see createPrintersTable() for details.

Note: There are helpful function to filter the result list to contain only LabelWriter or Tape printers; use dymo.label.framework.getLabelWriterPrinters or dymo.label.framework.getTapePrinters accordingly. This might be useful if your application is designed to print on die-cut labels or D1 tapes only.

Print Multiple Labels

Next, the sample shows how to print multiple labels at once, in one print job. The sample leverages the library’s LabelSet functionality do archive that. For each printer the sample creates one label set record represent data to be printed on one label. also the sample demonstrates how to apply different text styles to the print data. It uses a feature called text markup, the ability to apply formatting attributes/tags very similar to HTML ones. 

// create label set to print printers' data
var labelSetBuilder = new dymo.label.framework.LabelSetBuilder();
for (var i = 0; i < printers.length; i++)
{
    var printer = printers[i];

    // process each printer info as a separate label
    var record = labelSetBuilder.addRecord();

    // compose text data
    // use framework's text markup feature to set text formatting
    // because text markup is xml you can use any xml tools to compose it
    // here we will use simple text manipulations to avoid cross-browser compatibility.
    var info = "<font family='Courier New' size='14'>"; // default font
    info = info + "Printer: <b>" + printer.name + "n</b>"; 
    info = info + "PrinterType: " + printer.printerType;
    info = info + "n<font size='10'>is local: " + printer.isLocal;
    info = info + "nis online: " + printer.isConnected + "</font>";

    if (typeof printer.isTwinTurbo != "undefined")
    {
        if (printer.isTwinTurbo)
            info = info + "<i><u><br/>The printer is TwinTurbo!!!</u></i>";
        else
            info = info + "<font size='6'><br/>Oops, the printer is NOT TwinTurbo</font>";
    }

    if (typeof printer.isAutoCutSupported != "undefined")
    {
        if (printer.isAutoCutSupported)
            info = info + "<i><u><br/>The printer supports auto-cut!!!</u></i>";
        else
            info = info + "<font size='6'><br/>The printer does not supports auto-cut</font>";
    }

    info = info + "</font>";

    // when printing put info into object with name "Text"
    record.setTextMarkup("Text", info);
}

See print() function for a complete sample.

Note: Here is another blog post regarding using text markup. And one more regarding printing multiple labels.

Oct 122011
 

Suppose you are a developer and you are integrating a DYMO LabelWriter or LabelManager printer into your application by using DYMO Label Framework or older DYMO Label SDK API. Usually the integration is quite simple and "just works", and you can print a first label in a matter of minutes. Sometimes however, something might went wrong and don’t have the expected result. Or everything is fine on your machine, but the application does not work on the customer’s machine. What to do? Here are some tips could help in troubleshooting and investigating the problem.

Check DYMO Label software version

In most common usage scenarios, the DYMO Label software is required to be installed on the same machine where your application is running (for more information, see this and this). Usually we recommend to install the latest available version, unless there are knowing problems with a particular release. The latest version is available from DYMO site, here is the link.

Do a test print from DYMO Label software

Try printing a label from the DYMO Label software. DYMO Label software and the SDK libraries share a lot of underling code, so, if you can’t print by using the SDK, there is a big chance there will be problems with the DYMO Label as well. So, if you can’t print from DYMO Label or there are other problems running it, then contact DYMO tech support. Usually you will be asked to provide installation/configuration information, this can be obtaining by running LWSupport utility from the “[Program Files]DYMODYMO Label SoftwareSupport” folder.

Restart (open/close) web browser

If you are using DYMO Label Framework JavaScript library and just installed DYMO Label software, you might need to restart the browser to have the Framework plugins loaded. Also, you might need to restart the browser if you have added a new DYMO printer.

Verify browser compatibility and the Framework installation status

If you are using DYMO Label Framework JavaScript library, open http://labelwriter.com/software/dls/sdk/samples/js/CheckEnvironment/CheckEnvironment.html and click on “Check” button. The installation information will be displayed.

Collect trace/log information

DYMO libraries can generate log/trace information is not visible to end-user. To grab it use DebugView on Windows and standard Console application on Mac. On Windows: start DebugView, start your application, print a label, collect all messages displayed in DebugView. On Mac: open Console application, clear current messages, start your application, print a label, collect all messages displayed. Send all the collected messages to the e-mail address below.

Contact SDK support line

If you have any questions regarding the SDK, e-mail us at [sdkreply at newellco  com]. Please note, this is SDK-only support e-mail. For questions regarding DYMO Label software itself, please contact DYMO tech support

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 052011
 

An experimental support for QR code and PDF417 barcodes has been added in DYMO Label 8.3. You will have to edit a label file manually, because there is no UI support yet. Just create a label in DYMO Label, save it into a file, open a file in your preferred xml editor, locate barcode type element (XPath is like /DieCutLabel/ObjectInfo/BarcodeObject/Type); enter “QRCode” or “Pdf417 ” for the Type inner text. Now you can load this label using DYMO Label Framework JavaScript Library and set the barcode content as for any other barcode type, e.g. by using label.setObjectText() or record.setText(). It will work with other APIs we provide as well.

Here is a sample label contains both barcode types, http://labelwriter.com/software/dls/sdk/samples/QA-and-Pdf417.label

 

<!--?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips">
    <PaperOrientation>Landscape</PaperOrientation>
    <Id>Address</Id>
    <PaperName>30252 Address</PaperName>
    <DrawCommands>
        <RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270" />
    </DrawCommands>
    <ObjectInfo>
        <BarcodeObject>
            <Name>QRBarcode</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>
            <Text>1234567890</Text>
            <Type>QRCode</Type>
            <Size>Large</Size>
            <TextPosition>None</TextPosition>
            <TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
            <CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
            <TextEmbedding>None</TextEmbedding>
            <ECLevel>0</ECLevel>
            <HorizontalAlignment>Center</HorizontalAlignment>
            <QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
        </BarcodeObject>
        <Bounds X="331" Y="57.9999999999999" Width="1434.3307302029" Height="1435" />
    </ObjectInfo>
    <ObjectInfo>
        <BarcodeObject>
            <Name>Pdf417Barcode</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>
            <Text>1234567890</Text>
            <Type>Pdf417</Type>
            <Size>Large</Size>
            <TextPosition>None</TextPosition>
            <TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
            <CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
            <TextEmbedding>None</TextEmbedding>
            <ECLevel>0</ECLevel>
            <HorizontalAlignment>Center</HorizontalAlignment>
            <QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
        </BarcodeObject>
        <Bounds X="2086" Y="57.9999999999999" Width="2867" Height="1435" />
    </ObjectInfo>
</DieCutLabel>
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. 

image

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:

image

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 292011
 

The Firefox extension for DYMO SDK has been updated to support Firefox 7. The extension is available here. The FAQ article is here.

Please note that the Firefox extension is deprecated. No new development will be done for the extension. For new projects please use the Javascript library from the DYMO Label Framework. We encourage developers to switch to the new API even for current projects. Here are some benefits the new DYMO Label Framework API provides in comparison to the extension:

  • DYMO Label Framework API provides a cross-browser and cross-platform pure Javascript API. The same API supports all major browsers on Windows and Mac. The Firefox extension API can be used only in Firefox on Windows.
  • All necessary Framework installation is done by the DYMO Label software installer.  By contrast the Firefox extension must be downloaded by customers separately and installed manually.
  • DYMO Label Framework supports and will support all the DYMO printers. New printers will not be supported by the extension.

Sorry, but no auto-update functionality in this version. We will add it later and then re-release the extension.

 

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.