Apr 032010
 

So you’ve read somewhere that DYMO LabelWriter printers come with a software developer’s kit, commonly referred to as the DLS SDK. But you might be wondering how DLS SDK can help you and how much time you have to spend learning this SDK before you can start using it. Hopefully this blog entry gives you an idea on how easy it is to get started and also help answer some commonly asked questions by developers.

Before we get too far, let me first explain what the DLS SDK is: it is a programming interface designed specifically for label printing. Using the programming interface (API), one can build a label printing application with minimum amount of work.

Create a label printing application

The following section walks you through the steps of creating a label printing application using the DLS SDK. At the end of the section, you should have an understanding of the basic concepts and the working parts of the DLS SDK.

Step 1. Get the tools you need.

  1. The latest DLS 8 Installer (build 996). It’s important to install the latest version.
  2. The latest DLS SDK Samples. The samples installers installs documentation and technical references to the DLS SDK along with samples to give you an idea of the types of application you can create using the SDK.
  3. Visual Studio 2005 or 2008. I will be using VS2008, but what I do there can easily be done in VS2005.
  4. A PC with a LabelWriter printer connected to it and the latest DLS 8 software installed.

Step 2. Understanding the basic concepts in the DLS SDK

  1. Label File: A label file is a document that contains address, text, barcode, and/or images that you want to print on a label. You can perform various operations on a label file, like Open, Print, SaveAs, etc.
  2. Label Objects: The address, text, and barcode data that are stored inside a label file are logically separated into different label objects. Each object has its own set of properties that control how the object is printed on the label, and the DLS SDK provides access to programmatically create label objects and change label object properties.
  3. Data: The data is a general term for data (i.e. text, address, or image) that you would like to print on a label. The data source can be from user input, a file, or a database.

The DLS SDK ties these three concepts together to enable you to start printing labels in your application with a few lines of code.

Step 3. Defining your application.

To keep the blog short, I will define a simple application that lets users type in a list of to-dos for the day, and print out the list on a label to take with them for the day.

Step 4. Designing a label the application will print (download it here).

  1. start DLS 8, select a shipping label, then change the label orientation to portrait
  2. add a date-time label object on the label
  3. add a text object as header on the label
  4. add a text object as the area to list to-do’s on the label
  5. name the to-do’s text object “todos”
  6. save the label

This video shows you the steps to create the above label.

Step 5. Create an SDK application project in VS2008 (download it here). The important things to note are:

  • make sure the project is targeted for x86 platform. The reason is because the current DSL SDK works only in 32-bit mode (i.e. x86), so if your application is targeted for x64 or AnyCPU, you will not be able to use the DLS SDK.
  • Add a reference to the “DLS 7 Compatibility COM Type Library” in the project. Doing so allows you to use the COM objects that are available in the DLS SDK.

This video shows you the steps to setup the above project.

Step 6. Adding code to take in a list of to-do items from the user, then printing it on label (see listing below).

DymoAddinClass and DymoLabelsClass are the two main objects available from the High-Level COM interface in the DLS SDK. Combined, they provide methods and properties for you to open a label file, set data on label objects in the label file, and print the label. Keep in mind that the DLS SDK is much more extensive than just these two objects, and we will take time to explore them in future blog entries.

1 private void printBtn_Click(object sender, EventArgs e)
2 {
3     DymoAddInClass _dymoAddin = new DymoAddInClass();
4     DymoLabelsClass _dymoLabel = new DymoLabelsClass();
5 
6     // open the to-do-list label we created earlier
7     if (_dymoAddin.Open(@"......To-Do's List.label"))
8     {
9         // this call returns a list of objects on the label
10         string[] objNames = _dymoLabel.GetObjectNames(false).Split(new Char [] {'|'});
11 
12         // verify that our text object is on the label
13         if (objNames.Contains("todos"))
14         {
15             // take the to-do's list entered by the user
16             // and put in on the label
17             if (_dymoLabel.SetField("todos", todoEdit.Text))
18             {
19                 // let's print to the first LabelWriter available
20                 // on the pc, if the printer is a TwiTurbo, print
21                 // to the left tray
22                 string[] printers = _dymoAddin.GetDymoPrinters().Split(new char[] { '|' });
23                 if (printers.Count() > 0)
24                 {
25                     if (_dymoAddin.SelectPrinter(printers[0]))
26                     {
27                         if (_dymoAddin.IsTwinTurboPrinter(printers[0]))
28                         {
29                             _dymoAddin.Print2(1, false, 0);
30                         }
31                         else
32                         {
33                             _dymoAddin.Print(1, false);
34                         }
35                     }
36                 }
37             }
38         }
39     }
40 }
41 
(you can download the complete project here).

Done! As you can see, it didn’t take much to create a simple application that prints labels using the DLS SDK

  67 Responses to “First SDK Application”

  1. hi!

    I made an application that works for my x86 but we are working on a group and my friends PCs are x64… i did change the configuration manager to x86 but still no luck…. they are running vista with the latest dymo software…

    You know what could this be happening? how can i fix this.

    Thanks in advance,

    JC

  2. This tutorial rocked!!! For those who create this application on x86 and are having problems running it on x64 this is what you have to do:

    On a 64-bit Windows operating system:

    Assemblies compiled with /platform:x86 will execute on the 32 bit CLR running under WOW64.

    Executables compiled with the /platform:anycpu will execute on the 64 bit CLR.

    DLLs compiled with the /platform:anycpu will execute on the same CLR as the process into which it is being loaded.

    To set this compiler option in the Visual Studio development environment
    Open the Properties page for the project. For details, see How to: Set Project Properties (C#, J#).

    Click the Build property page.

    Modify the Platform target property.

    Note /platform is not available in the development environment in Visual C# Express.

    Source: http://msdn.microsoft.com/en-us/library/zekwfyz4(VS.80).aspx

  3. Hi,

    Thanks for the tutorial, however this does not work at all…

    Latest DLS, Latest SDK

    Environment: Windows 7 32-bit
    IDE: VS 2008, VS 2010

    When running your application I can see the following in the output
    WindowsFormsApplication2.vshost.exe Error: 0 : Error: Object reference not set to an instance of an object., Error Source: DYMO.DLS.SDK

    Please help

    Best regards,
    Ingo

    • Hi Ingo,
      Can you tell me if you have DLS 8.2.1.913 installed? I think that’s the cause of the problem.
      How to check the version:
      1. Start DLS 8 application.
      2. Go to the About box from Help | About DYMO Label
      3. You should see the version listed there.
      4. If you do not have the right version, download and install version 8.2.1.913 (a downloadable link is in step 1. of the blog: Get the tools you need).

      If you do have the version 8.2.1.913, then the issue might be caused by this registry value:
      HKEY_CURRENT_USERSoftwareDYMODLS 8 SDKBackward Compatibility LibraryCurrent Printer
      Delete this value and rerun the sample application.

      Let me know if the above fixes the problem you have. The registry value problem is fixed in version 8.2.2.x, which will be released this week on our website and on CDs. Once you’ve developed your application, users will likely have upgarded to 8.2.2.x so there should not be any issues for your users.

      Best,

      CK

      • Hi Ingo,
        One more thing to check: If you’re debugging the sample application, do make sure you run visual studio as administrator.

      • The deletion of the registry entry does the trick. Thank for your help.

        Best regards,
        Ingo

  4. Hello
    We have several App that use a older ver. of Dymo SDK as well as VB5& VB6
    how can we use this software to work with a LabelWriter 450?
    Thanks

  5. I have an application that has been using the DLS SDK for years without any issues. I am now getting feedback from my customers with Windows 7 that the labels are printing out blank. Do I need to install the newest SDK or is there something else I should be looking at? I do compile in X86 mode and don’t have any other issues with the application on Windows 7 except this.

    Thanks,
    Scott

    • There are many reasons why a blank label might be printed. This can be caused by opening the wrong label file, trying to open a label file that does not exist, or by using the wrong or a non-existent label object when adding data to the label. Try opening the label file in DLS 8 first. Most functions in the SDK return some type of status to indicate if the operation is successful. Checking for the return status of these functions can help you track down where things are going wrong. Specifically, if you are using a label template with a call to Open(), ensure that this label exists on the customer’s system. Your SDK application will default to using the ‘last used label’ of your customer if it cannot find the label template. For instance, if your template has a TEXT object on it, but the last used label only has an ADDRESS object as part of its layout, then a blank label will result.

    • Also make sure the customers have the latest version of DYMO Label software installed. There were several issues related to the SDK with a release came on CD. The latest version can be downloaded from here. Currently the latest version is 8.2.2.996

  6. Using several Labelwriters 400 for many years on XP with JS
    DymoAddIn.SmartPasteFromString(‘dit is een SmartPasteFromString test’);
    always was using fine.

    Now bought an labelwriter 450. Installed Dymo label V8.2.2.996 and SDK 8.2 yTZafJfd_DZEy7LlfnRsYSCzTQgzVctU…
    which looks is the latest.

    However SmartPasteFromString does not work anymore. Are there alternatives ????

  7. Since i had to, this has been solved. The problem occured when i used dymoLabelv8, DLS 7 and DLS 7update.
    When i removed all that, rebooted and then only installed dymolabelv.8.2 everything worked flawlessly.

  8. Is there a final driver available from Dymo for Win7 64 bit?

    • It is unclear about what drivers you are talking about. If you need printer drivers, then they are available for a long time already and included with DYMO Label software installer or as a separate package from DYMO support page
      If you are referring to DYMO SDK/DYMO Label Framework, then it will be released in one-two weeks.

  9. We recently purchased a store that has the DYMO label writer twin turbo, I am unable to print labels both of the blue lights are flashing, i put in another roll of stickers and it is still flashing. If you have any info on getting it going again I would appreciate it.
    Thanks,
    Tanya M McBain

    • If lights are flashing that means the labels are not loaded correctly. Please, look at user manual to make sure the labels are loaded right.
      DYMO Tech Support can help you with problems like this.

  10. Hi,

    I have a big problem … Currently I am maintaining a VB.NET 1.1 application and the client would like to print some addresses using a Dymo LabelWriter 450 Turbo. Tried printing directly from the application, having only the windows drivers installed.
    Sometimes it’s working. I manage to print between 3-5 labels (Dymo 99012) after which I am getting an “Out of paper message”. Do you have any suggestions regarding how can I solve this problem?
    Leaving this a side, I tried installing the SDK 8. I took the VB .net project provided as Example and converted to Visual Studio 2003. I’ve added the reference to the DLS SDK Com Type Library I build it and everything is ok, but when I try to run it I get an System.IO.FileNotFundExecption at the line
    DymoAddIn = New Dymo.DymoAddIn.
    Thanks,
    George

    • RE printing with drivers: make sure the paper size selected in drivers is the same as the labels in the printer. Also, make sure the labels are properly aligned in the label spool.

      Re SDK:
      – what version of DYMO Label software do you have installed?
      – is/was there any other version of DYMO Label software installed? If yes, what version?
      – did you try to install the latest version? as for now it is 8.3.0.1242
      – are you sure it fails on DymoLabelAddin object creation and not on other “file” operation (based on exception type)?

      Thanks,
      Vladimir

    • Hi George,

      I’ve recently begun developing a DYMO label printing application and am running into the issue you mentioned about printing a few labels and then receiving an “Out of Paper” error message. Did you ever figure out a fix for that error? I’ve scoured the internet and read through the framework documentation and I cannot find a solution. Any help you might provide would be much appreciated.

      Thanks,

      Shawn

  11. Hi – I have created a vb.net application using vs2008 on windows7 for printing labels onto Dymo Labelwriter 400 turbo and 450 turbo. I was able to print on my XP machine too. Everything works well on my machines, but when I install it on the clients machine, the labels are not printed. Where does the printer looks for the template by default? How can set it up so my labels are print the text I am feeding thru my application. Can somebody please help me. This is really critical for me. Thanks – mydhili

    • First, make sure DYMO Label software is installed on the client machine. Next, you have to open/load template explicitly by calling DymoAddinClass.Open() method.

      Also, I would recommend using DYMO Label Framework. It suits better for .NET development. See, http://developers.dymo.com/2010/06/02/dymo-label-framework-overview/ or http://developers.dymo.com/2010/07/21/how-to-set-data-on-your-label-using-the-sdk/ for more information.

      • Thank you for replying, I have installed DYMO label software on the client machine.
        Do I need to include any particular dll’s along with my installation in order for it to print the data my program is feeding?
        I am using the following code to feed data.

        myDymoAddin = new DymoAddIn();
        myLabel = new DymoLabels();
        if (myDymoAddin.Open(@”c:Documents and SettingsAll UsersDocumentsDYMO
        LabelLabel FilesTestLabel.label”))
        {
        myLabel.SetField(“TEXT1”, “Testing, testing”);
        myDymoAddin.StartPrintJob();
        myDymoAddin.Print(1, FALSE);
        myDymoAddin.EndPrintJob();
        }

        and created a DYMO Label template with Address field as a default template. I can change the template by opening dymo and my program prints to the newly created template.
        I am not sure what files I am missing in the installtion that are on my development machine. I also downloaded the SDK files on to the client machine.

        • most likely the file ”c:Documents and SettingsAll UsersDocumentsDYMO LabelLabel FilesTestLabel.label” is missed on the client machine. You have to distribute the label file within your application.

    • Hi,

      I am looking for the code for my .net application.Could you please send me the code?

      Thanks!

  12. New at this and having trouble with

    public DymoAddInClass DymoAddIn;
    public DymoLabelsClass DymoLabels;

    keep getting

    Interop type ‘Dymo.DymoAddInClass’ cannot be embedded. Use the applicable interface instead.

    any hints? I have added the reference, using VS2010

    Thanks for any help

    • Either disable embedding interop assemlies into your assembly by going into to project references, select dymo, right click, Properties, set “Embed Interop Types” to False.
      Or update the code like

      IDymoAddIn dymoAddIn;
      dymoAddIn = new DymoAddIn()

  13. Hi, I’m using the DymoSDK with VB6, when I compile my Software, the exe file is running well, but if I start the software with VB6. VB6 doesn´t respond anymore.

  14. Hi , I just inherited a project in VB6 code that interfaces with a LW350. The task is now to make the same work on a LW 450.
    I read somewhere that there is a DLL that would make it compatible. Is it true? If yes how would I do it?.
    In any case, I downloaded the SDK, and wanted to try the samples. The VB .Net sample did not have a reference for the Interop.Dymo, after I added it, it tells me that the Dymo.DymoAddIn, and Dymo.DymoLabels are not defined.
    I am reading in other posts to remove that reference and add instead the DymoUniversalAddIn (DymoAddIn, or
    DYMO Universal Add-in 2.0 Type library). If so, can you send me a tutorial on how to do this? The videos are not longer available. I also tried the C# WindowsFormsApplication2 project with similar problems. Even thought the Dymo the Dymo was added as reference, it could not be located Can you please help on how to start a simple project?
    Thanks!

  15. Thanks Vladimir taht worked! Now, would that also make work an app
    that was built using version 4.0 of the SDK? Thanks again

    • Yes, it will work. One possible problem – a label file might be too old. it is easy to check and fix. Try to open the label file(s) used by your application within DLS v8. If the file opened OK, then you are fine. Otherwise, you will need either recreate it in DLS v8 or try to open and resave in DLS 7.8.

      • HI, I just finished a prototype that uses the LW450 referencing the Interop.Dymo.dll for a .Net app. My problem is that when I tried to install my files in another computer I get a COM error i.e. 80040154 when instantiating the DymoAddInClass. I already installed the printer driver software. Are there any other dependencies?
        We would like to just install just the necessary files for this to work instead of the whole software. Can you let me know which are the files necessary for distribution? Thanks!

  16. HI again Vladimir, I am now dealing with a BarcodeLibrary.config file (DLS SDK 4.0) which I believe has been replaced by the .Label file in DLS SDK 8.0. However, when trying to print a barcode, I am not able to find the equivalent to the tag which allows me to print text above the barcode. How can I get this header in the properties of the barcode that I need to print?. Also, I noticed that a recently printed barcode label was not very sharp. How do I troubleshoot that? Thanks again

  17. Hi,
    Our compagny has used dymo labelwriters for years to directly print adress labels from goldmine. This still works perfectly on windows xp, but recently we started migrating to windows 7 (32 and 64 bit). There we face problems with the dymo + goldmine. The old dymo software : version 7.2 orso won’t recognise the printers anymore (possible driver issue). The new dymo software works, we can print from it without problems, except from goldmine.

    I managed to open the dymo label program from goldmine, but it gives me an error : Cannot open label file ‘/GM : Cannot load labelsjabloon ‘/GM .
    Basically we click File – print label in goldmine and this opens up the dymo label software and enters the adress of our customer and prints it.
    3 times a year we have it automated to print over 4000 automatically. We bought the labelwriters speciffically for this purpose and we are not really happy to see that officially there is no more support for goldmine. One of your helpdesk told me to ask it here and hopefully somebody here has an idea on how to make either the old software work under windows 7 or have the new software load the labelsjabloon.

    Thx in advance
    Dave Timmermans
    D.timmermans@periskal.com

  18. `As a Delphi programmer, I’m beginning to feel like a polar bear on a melting ice floe… I understand that it may no longer be relevant to include full Delphi samples, but maybe you could point me in the right directions? I’ve been programming a long time, but my COM knowledge is very marginal at best.

    I have a program that’s been working well with the previous Dymo LabelWriter and SDK software. I created a unit Dymo_TLB from the type library (or maybe it came with the previous SDK). I’m now running Win7Pro x64, RAD Studio Delphi 2009, and Dymo software and SDK 8. The relevant parts of my old code are:

    uses ComObj, Dymo_TLB ;
    ……
    var DL : IDymoAddIn ; LB : IDymoLabels ;:
    ……
    DL := CreateOleObject(‘Dymo.DymoAddIn’) as IDymoAddIn ; // actually, in a try..except
    LB := CreateOleObject(‘Dymo.DymoLabels’) as IDymoLabels ;
    …..
    LB.SetField….
    DL.Print…..
    ….and so on….

    I tried to use the Delphi Import Type Library to create a unit from “DYMO.Label.Framework.tlb”, but Delphi choked on it with “Error accessing the OLE registry.” I was able to import from “Dymo Label Software v.8 SDK” to create unit DYMO_DLS_SDK_TLB.pas (with a lot of error messages about redeclares).

    Using this TLB, I’m trying:

    uses ComObj, DYMO_DLS_SDK_TLB ;
    ….
    var DL: ISDKDymoAddIn ;
    …..
    DL := CreateOleObject(‘Dymo.DymoAddIn’) as ISDKDymoAddIn ;
    ….
    this syntax-checks ok (showing that the types in the TLB are recognized, but this last statement blow up with “exception class EIntfCastError with message ‘Interface not supported'”

    I feel that I’m on the right track, and maybe close, but for the moment I’m stymied. Am I using the right type library? If not, is there some way I can import the other one? Any pointers you can give me would be greatly appreciated. –Howard
    (Tried to Post this Comment, button changed to “Posting Comment…” and nothing happened; trying again, and I hope that I’m not double-posting)

    • Your application should continue working OK, without any code changes at all. Just make sure your have latest (8.3.1) DLS installed. If you want to recreate Dymo_TLB (but again, it is not necessary), then just import “DLS SDK COM Type Library” (DLSSDKCOMLibrary.dll), not DYMO.Label.Framework.

      • Many thanks for helping, Vladmir,.

        If possible, I would like to use the most up-to-date type library. I couldn’t find DLSSDKCOMLibrary.dll on my computer; the closest I could find was DYMO.DLS.SDK.dll (in Program Files (x86)DYMODYMO Label Software), which caused an error while importing, and DYMO.DLS.SDK.tlb, which did not. However, the simple method:

        uses ComObj, DYMO_DLS_SDK_TLB {the imported tlb} ;
        procedure TForm1.Button1Click(Sender: TObject);
        var DL : ISDKDymoAddin ;
        begin
        DL := ComObj.CreateOleObject(‘Dymo.DymoAddIn’) as ISDKDymoAddIn ;
        Label1.Caption := DL.GetDymoPrinters ;
        end;

        blows up with “Interface not supported” at that first assignment. As I said, I have very little experience with COM or Interfaces, but I feel that I’m close, with the solution just out of reach. Wrong tlb? Wrong call? Wrong cast?

        Thanks again, and seasonal greetings to you and yours. —Howard

        • make sure you have DYMO Label software 8.3.1 installed. If installed, DLSSDKCOMLibrary.dll should be in the “Program Files (x86)DYMODYMO Label Software” folder. Do NOT use DYMO.DLS.SDK.dll, it is internal library…

    • Also, the old Delphi samples are available with DLS7 SDK (http://download.dymo.com/Download%20Drivers/Software%20for%20DYMO%20LabelWriter/Downloads/13/WIN_DLS_SDK_0508.EXE). You can install it alongside with DLS 8 and DLS 8 SDK. All DYMO SDKs contain samples and documentation only, so there will no conflicts.

  19. Can anyone post a simple sample for printing a label in VB6?

    Many thanks

  20. Hi, I just deployed my first SDK, and I was able to completely test its functionality on a Windows 7 machine. I deployed to a variety of platforms, and I recently got some feedback about the printer not printing all the time that the function was requested. I am now trying to trobleshoot the problem with status messages according to the return values of the functions involved.

    Given this, I would like to know if the call to: Print(Copies: Integer; bShowDialog: WordBool) ignores the state of the bShowDialog flag, ideally I would like to display the status of the printer ( when printing or failing ). The SDK documentation states that the flag is ignored. It takes time for the user to realize that the printer is doing its job when it just starts because It takes a while to instantiate its objects, The user may think that it failed because it expects it to print faster, and if the user is not paying good attention, the impression may be that it is not working. Even though after the first print the response time is much better, it would be great to keep the user informed that there is something going on that appears to be working.

    Are there any other better mechanisms to troubleshoot the status of the printing operation?

    Thanks!

  21. Hi,

    We are having issues in setting the size of the text on the label. We tried using the AlwaysFit, ShrinkToFit options but it seems as the width of the text increases the whole text becomes unreadable while always leaving the right hand side of the label empty. for eg if one of the line is Loan Type: 30 Year Chip, its quiet good and readable but when the size increases as LoanType: J10 Year Int Only LIBOR aMT 5/12/25 ABC. THEN it appears so small that it is unreadable and further it tries to fit in almost half the label and doesnt use the other half. I am using 28 x 89 mm six labels

  22. […] found here). Once DLS is installed, you should be able to find the type libraries as described in this […]

  23. Hello,

    I am on Win2012 R2
    Using VS 2013
    Silverlight Application

    Installed the latest software.
    Running Web site Integrated mode/32 bit true
    I am getting an error:

    Using IE 11

    dymoAddIn = new ActiveXObject(‘DYMO.DymoAddIn’);

    Undefined

    Please helpl.

  24. Hello, I am using DYMO to create and print labels for customers. Recently I have ran into some trouble. My dymo code and printing works awesome locally in visual studio, but once I publish to my server, it stops working. After researching my error message, it appears that I need to register my COM class (specifically DLS7 Compatilibity COM type library 1.0) but I cannot find the dll anywhere. I have installed, reinstalled and double checked both the SDK install and the regular DYMO install file. Why am I missing the DLS7 Com? Where can I find this file? Thank you.

  25. I am using TDymoDrucker class in delphi to print a label. I am able to print a lablel on click of a button using DymoAddIn.Print(1,true); but on click of another button in the same form, i am not able to print a label. It doesn’t show any error message or failure. Is there any other way to print the label. Thanks

  26. i am using dymo lib to print the label, label has barcode. it works when i ran my code through desktop app.
    fails when i call through web service. same code.

    • Could you elaborate a little more on the issue?
      Are you using the DYMO JavaScript Framework? What do you mean by destop app? Does your .label file print with DYMO Label Software (DLS)? What kind of error are you getting? Does it work with a DYMO sample app? Are you running desktop app and web service on the same PC, since the SDK installer does not any install any SDK binaries, only samples. All binaries required for the SDK are installed with DYMO Label Software (DLS)?

  27. We have maybe label writers in our organization, occasionally we need to swap computers/label writers, every time we do this another label writer shows up in the menu, to select from, though only one is attached. Is there anyway to hide or remove unattached printers. I have a nice test printer dialogue, but it is confusing for users everyt ime

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)