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.

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

http://www.labelwriter.com/software/dls/win/DLS8Setup.8.2.3.1026-BETA.exe

http://download.dymo.com/download/Win/DLS8Setup.8.3.1.1332.exe

SDK Installer (Documentation and Samples)

http://www.labelwriter.com/software/dls/win/DYMO_Label_v.8_SDK_Installer.8.2.3.123-BETA.exe

http://www.labelwriter.com/software/dls/win/DYMO_Label_v.8_SDK_Installer.exe