Jul 212010
 

A common question after reviewing the SDK sample applications installed with the SDK installer is “how can I set my own specific data onto the label in a format and layout of my choosing?” To do this you create a label using DLS 8. You can add label objects (Address, Text, Barcode, Image, etc.) onto the label and save it as a ‘template’ for your SDK code to use.

Scenario 1: Adding a TEXT object

First, run DLS 8 and design a label. Go to the Designer tab and edit the label. For this example, add a TEXT object by double-clicking on ‘Text’. You should now have a resizable rectangle on your label (see screen shot below).

Next, double-click on the rectangle to set the text object properties. Select the Advanced tab from the resulting dialog box. In the edit control titled ‘Reference name’ choose a unique name for this object (see screen shot below).

In this sample, I chose to name the object ‘TEXT1’. Your SDK code sets data on this object using this unique name. For instance,

Framework SDK (sample written in VB.NET)

Private Label As DYMO.Label.Framework.ILabel
Label = DYMO.Label.Framework.Framework.Open("c:Documents and SettingsAll 
UsersDocumentsDYMO LabelLabel FilesTestLabel.label")
Label.SetObjectText("TEXT1", "Testing, testing")
Label.Print("DYMO LabelWriter 450 Turbo")

DLS SDK API (sample written in C#)

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();
}

Output:

This sets the text, “Testing, testing”, onto the TEXT object which you named TEXT1 on your label. The exact same process would work for creating an ADDRESS object or a BARCODE object. You would simply refer to any other object you create by the name assigned in the Properties dialog (“TEXT1” in our example) and change the corresponding line of code which sets the data onto this object. For example, if I had added a barcode object and assinged it the name ‘MYBARCODE’, my call to set the data for this barcode object might resemble the following:

myLabel.SetField("MYBARCODE", "97820315");

See Scenario 2 (below) for greater detail about adding a barcode object.

Scenario 2: Adding a BARCODE object

If instead, you would like to add a barcode object (either in addition to the TEXT object from Scenario 1 or all by itself), again, run DLS 8 to add this object to your label file template. Go to the Designer tab and edit the label. Add a BARCODE object by double-clicking on ‘Barcode’. You now have a resizable rectangle on your label (see screen shot below).

When you size the barcode object make sure its large enough to hold the barcode for your data! Next, double-click on the rectangle to set the barcode object properties. Select the Advanced tab from the resulting dialog box. In the edit control titled ‘Reference name’ choose a unique name for this object (see screen shot below).

In this sample, I chose to name the control ‘TEST_BARCODE’. Your SDK code sets data on this object using this unique name.  Next, click on the ‘General’ tab of the properties dialog box. You are now presented with options to change the barcode symbology (see screen shot below).

The code sample below will set the barcode data to ‘9876543’ for the particular label printed.

Framework SDK (sample written in VB.NET)

Private Label As DYMO.Label.Framework.ILabel
Label = DYMO.Label.Framework.Framework.Open("c:Documents and SettingsAll 
UsersDocumentsDYMO LabelLabel FilesTestLabel.label")
Label.SetObjectText("TEST_BARCODE", "9876543")
Label.Print("DYMO LabelWriter 450 Turbo")

DLS SDK API (sample written in C#)

myDymoAddin = new DymoAddIn();
myLabel = new DymoLabels();
if (myDymoAddin.Open(@"c:Documents and SettingsAll UsersDocumentsDYMO 
LabelLabel FilesTestLabel.label"))
{
    myLabel.SetField("TEST_BARCODE", "9876543");
    myDymoAddin.StartPrintJob();
    myDymoAddin.Print(1, FALSE);
    myDymoAddin.EndPrintJob();
}

Output:

Conclusion

The format of the label (objects found within the label and their locations) printed from your SDK application can easily be edited using DLS 8. The data passed to the objects is controlled through the SDK application itself. Using the SetField() functionality you can set your desired data into the formatted label template with total control.

  119 Responses to “How to set data on your label using the SDK”

  1. Hello!

    Regarding your Comment section on this about easily editing the format of a label: We want to use a .NET service to print on “Thermal Transfer Cryo-Tags” with a format of 1.50 x 0.50 inches (i.e. 38mm x 13mm).

    With the SDK/drivers used (v8.2; LabelWriter 400 Turbo) we have not found a possibility to create a .label file that can be used within our project to actually print a label. Any idea how to achieve this?

    Thanks!

    • The easiest way would be to use “large enough” label type to create a layout. For example, open DYMO Label software, select Shipping label type (it size is 2.125 x 4 inches), select portrait orientation, put any desired objects on desired positions (make sure they fit inside bounds of Cryo-Tag label), save the label. Now you can print on your Cryo-Tags labels using the saved label file.

  2. I can place data into a text object from my program (Your samples here made it quite easy!) but, when placing some descriptive text in a TEXT field, how can I get the data to wrap to multiple lines? Currently the data is either shrunk to microscopic size using “Shrink to Fit” or is simply truncated.

    Thanks,
    Steve G.

    • Unfortunately, Text object does not support word wrapping. So, the only choice is to manually separate the text to multiple lines.

      • Hmm… How would I find the size of the field and how it’s being rendered (font size/style/etc.) so I could determine where to put word breaks to wrap text?

        Thanks,

        Steve G.

        • This might be tricky. If your application uses a predefined label layout/file(s), then the simplest way is to open it in DYMO Label software and to estimate how many characters are fit in one line by just typing into the desire field(s) on the label. Knowing the average number of characters per line you will be able to split the input string into multiple lines. It is not necessary to know the exact layout for the text, because shrink-to-fit will do necessary shrinking if needed (it is even better to use ‘always-fit’ setting, so the text can be enlarged as well).
          If your application can print any label (a label somehow specified by a user) then you could use low-level API to get the object’s dimensions (using ILabelObject.Width and/or ILabelObject.Height) and object’s font information (using ITextObj.TextAttributes.Font_1 and ITextObj.TextAttributes.Font_2). Knowing these values you can calculate average chars per line using Win32 API or .NET text measuring functions.
          Both of these methods are not ideal, but there is no other way.

  3. Vladimir – Thanks for the information on splitting strings. How do I get access to the “low-level API”?

    Thanks,
    Steve G.

    • Low-level API is implemented by the same COM library as high-level API (Dymo.LabelAddIn object). Just use Dymo.LabelEngine object instead of Dymo.LabelAddIn Dymo.Labels objects. SDK contains a sample how to use “low-level” API in Low Level COM/Visual C++ folder.

  4. Which file in the “Dymo.v8.2.2” SDK directory contains “DymoAddIn” and “DymoLabels”? I’m writing my program using LabVIEW2009 and .NET VIs. I have found “DymoAddIn” and “DymoLabels” constructors only in DYMO.DLS.SDK.dll file in the “DYMO Label Software” subdirectory. While the methods for Open, SetField, and Print return a TRUE, my Dymo400 doesn’t print. I can print using the DLS.exe of the same directory.

    Any help is greatly appreciated!

  5. How to change an image in a label loaded with javascript? SetObjectText will work for labels but the function label.setImageFile says “label.setImageFile is not a function”…

    • Solved.

      var label = dymo.label.framework.openLabelXml(labelXml);

      var myURI = dymo.label.framework.loadImageAsPngBase64(“http://www.myhost.com/myimage.jpg”);

      label.setObjectText(“myimagename”,myURI);

      • yes, loadImageAsPngBase64() will do it. A word of caution though: loadImageAsPngBase64() (as well as openLabelFile) is designed as a last resort – use it only if you cannot load an image/label file using standard browser’s capabilities, e.g. when you have to open a local file or load it from a different domain. So, the better way is to get base64 encoded data directly from the server, e.g. right some script to return base64 encoded data, then get it using Ajax, and finally pass the data to setObjectText(). So, the code might look like:


        var label = dymo.label.framework.openLabelXml(labelXml);
        $.get("getImage.php?image=myimage.png", function(imageBase64)
        {
        label.setObjectText("myimagename", imageBase64);
        }, "text");

        where getImage.php is a server-side script.

        Another way to is to load image data into Image object, render it into Canvas and finally get base64 encoded png data using Canvas.toDataURL() method.

        From the openLabelFile/loadImageAsPngBase64 documentation:

        There are some considerations should be taken into account before using this function.
        Use it only then there are no other way to load label data, that in most cases should be done using openLabelXml()
        – full file name/url should be specified. The function will not honor relative paths based on document.location.href
        – the fileName can be http:// or file:// urls. On Windows it can be a regular file name, like ‘c:usersdesktopaddress.label’
        – the content of the label will be loaded synchronously. So if the remote server is down there will be a timeout.
        – any local file can be accessed/tried to be accessed. The function is not limited by any browser restrictions.
        Though only a valid label file (according to label.xsd schema) can be loaded this still can be potential security concern.
        – the URL is not limited to same-site-origin browser policy – any url can be opened
        – the proxy settings are system default settings, not necessary browser settings.

  6. so is the new sample musing the beta sdk or the old ones ?
    what is the status of the new beta sdk?

    right now i have not found any sample that works with c# for any of the sdk versions i have downloaded yet.

    win 7 pro x64 and VS 2010

    I need to make a working sample using COM interop so that i can create a Silverlight out of browser app that prints labels.

    • We have samples for both APIs. For the Framework there is VS2010 solution located at DYMO Label FrameworkSamplesDYMOLabelFrameworkSamples.vs2010.sln For current API the sample is at Backward Compatible SDKSamplesHigh Level COMdotNET SamplesC# SampleCSharp Sample.csproj It is VS2005 project, so open it in VS2010 and reimport COM-references. If you have problems running theses samples – please describe the problem in details.

  7. We are trying to set an image as outlined above, with no luck. We’re attempting this as using base64 encoded data keeps giving us an ‘label template cannot be loaded’ error.

    Any insight into this would be helpful.

    • If you got ‘label template cannot be loaded’ error then something wrong with your label definition. Are you trying to load label from a file or url? If so, make sure you can open it inside DYMO Label software to make sure the label definition is OK. If you are loading the label from a hardcoded xml string, agian make sure the string itself is a valid xml and confirms to the schema

      • We re-encoded the graphic with an online encoder and used that in the XML file and that solved the issue. Thanks for your response.

  8. Is it possible to get an image that has been copied into clipboard into the image object of a label through .NET?

    • yes, though there is no separate method for that. The code will look like

      if (Clipboard.ContainsImage())
      {
      var clipImage = Clipboard.GetImage();
      var encoder = new PngBitmapEncoder();
      encoder.Frames.Add(BitmapFrame.Create(clipImage));

      var stream = new MemoryStream();
      encoder.Save(stream);
      stream.Position = 0;

      label.SetImagePngData("imageName", stream);
      }

  9. I’m passing base64 encoded images from PHP to JS using AJAX;

    I got 4 images on a label, but sometimes there should be less images, is there a workaround so I can ‘hide’ an image on the label?

    • I can think about three ways of doing it:

      • create a LabelSet and set data for correspondent image object to an empty string, this will clear the image content. Usually you will use LabelSet to print multiple labels at once, but it can be used to print just one label as well. To put image data into a LabelRecord use setBase64Image() method. For an complete example see http://developers.dymo.com/2010/06/17/dymo-label-framework-javascript-library-print-multiple-labels/
      • create and load a separate label file that will have only image object needed
      • create an 1×1 white pixel image on the server and use it as the image in case when no image is needed.
      • I didn’t want to wait for a solution so I tried some stuff;
        But setting the image object to an empty string causes a fault I guess, because Dymo can’t load the label then.
        So what I did was putting 4 images on the label, wich are white images, and replace that. And it works great at the moment!

        BTW, is there a chance to get the unminimized code? Because I’d like to show an alert when the user hasn’t installed the Dymo framework sdk. At this time an exception is thrown, but the user can’t see this…

  10. Do you have an example of how to pull data out of a MYSQL database, and the print it via a browser using PHP?

    • We don’t have the complete sample for that. But if you make the data available from the web-page in some sort of Ajax, then you could adapt this sample to use your data instead of Google Docs

  11. Hi,

    how can I change the text size of the TEXT object in C#?

    THX

    • Just for clarification – are you trying to change the object size or font size of the object’s text?

      if you want to change the object size there are two ways. First is to design a label using DYMO Label software, where you can adjust the object sizes visually. Second, using SDK API. For DYMO Label Framework a sample code will be:


      using DYMO.Label.Framework;
      var label = Label.Open(@"MyLabel.label") as IDieCutLabel;
      var oldBounds = label.ObjectBounds["MyTextObject"];
      var newBounds = new Rect(oldBounds.X, oldBounds.Y, oldBounds.Width, oldBounds.Height + 360); // 1/4" taller
      label.ObjectBounds["MyTextObject"] = newBounds;

      • Hi Vladimir,

        I am trying to change to font size, not the object size. The object size is fine in my designed label.

        THX

        • you can look for an example of ILabelSetBuilder interface in the DYMOLabelFramework.chm help file available in the SDK installation. Below is a sample function

          public void PrintWithLabelSet()
          {
              // open a label
              ILabel label = Label.Open("TextLabel.label");
          
              // create a builder object to populate label set 
              ILabelSetBuilder labelSetBuilder = new LabelSetBuilder();
          
              // label #1 - use font specified in the label file
              ILabelRecordBuilder record = labelSetBuilder.AddRecord();
              record.AddText("TEXT", "6x7=42");
          
              // label #2 - specify font programmatically using StyledTextBuilder
              record = labelSetBuilder.AddRecord();
              IStyledTextBuilder styledTextBuilder = new StyledTextBuilder();
              styledTextBuilder.Append(new StyledTextBlock("6x7=", new FontInfo("Courier New", 36, FontStyle.None), Colors.Black));
              styledTextBuilder.Append(new StyledTextBlock("42", new FontInfo("Courier New", 36, FontStyle.Bold), Colors.Black));
              record.AddStyledText("TEXT", styledTextBuilder.StyledText);
          
              // label #3 - specify font using a markup string
              record = labelSetBuilder.AddRecord();
              record.AddTextMarkup("TEXT", @"<font size='36'>6x7=<b>42</b></font>");
          
              label.Print("DYMO LabelWriter 450 Turbo", null, labelSetBuilder.Xml);
          }
          
      • Unfortunately it didn’t install the “DYMOLabelFramework.chm”. When I use your code Visual Studio tells me that I’m missing a reference, but which one?

  12. I’m using v.8 on Windows 7 64bit, if that changes anything.

  13. I’ve been asking for years… when are QR code support coming for web label printing? What is the easiest way to implement them now without waiting?

    • Experimental support for QRCode (as well as for PDF417) 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” 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. using label.setObjectText() or record.setText().

  14. Hello! I’m just starting to develop for Dymo functionality and I was trying to follow your example here but I can’t seem to get the file to open. Pertinent info:

    Using Visual Studio 2010
    Using VB.Net
    I think I have included the reference correctly but am unsure. I included the COM called “Dymo Label Software 7 SDK Compatible Library” (I was unable to include or even find the files for the version 8 sdk)
    I am simply trying to do a test print to see if I can get things working but as I said the boolean returned from trying to open the file returns false. Here is the code snippet below.

    Public Class frmMain

    Public DymoAddIn As Dymo.DymoAddIn
    Public DymoLabels As Dymo.DymoLabels
    Private Sub btnOpenPrint_Click(sender As System.Object, e As System.EventArgs) Handles btnOpenPrint.Click
    DymoAddIn = New Dymo.DymoAddIn
    DymoLabels = New Dymo.DymoLabels

    DymoAddIn.Open(“C:CPSLabelsCPSLabelsCPSLabelsCPS.label”)
    DymoLabels.SetField(“txt1”, “Test!”)

    DymoAddIn.Print2(1, False, 1)

    End Sub
    End Class

    I tried DymoAddin.Open2 and the prompt that came up would only look for .lwl files which I tried saving the label as but still a no go.

    Any help on how to get this simple test up and running would be greatly appreciated

    Cheers,
    Hoyty

    • make sure you have DLS 8.3 installed

      • Well I feel dumb now! Thanks though!

      • It seems that if I change the path to smaller such as “binCPS.label” rather than the full path I can print the label but the custom fields are not getting set. Any guidance as to why this might be happening? I’d rather not have to include a full solid file path if I don’t have too.

  15. Is there a way to set the font to different values in the same “Text” object in a label? the reason i’m asking, is because i need to use the continuous label, but when i do this i can only use one text box (because that text box is automatically set to the width of the label and i can’t change the value; it is grayed out)

  16. The code below to load the image into the label is not showing the image.

    I there something wrong with the code?

    $.get(“getimage.php?filename=Photos/” + VstPic + “&filetype=png”, function (imageBase64) {
    myWindow.document.write(“Picture is encoded.”);
    label.setObjectText(“VstPic”, imageBase64);
    }, “text”);

    • Assumed that you called label.print or label.render to see the result of loading the image here are some suggestion for debugging:
      – make sure the object name is specified correctly. The name is case sensitive.
      – make sure you use the standard base64 encoding and NOT url-safe base64.
      – try to use DebugView as described in http://developers.dymo.com/2011/10/12/sdk-troubleshooting-tips/ to see the runtime error messages.
      – grab the value of imageBase64 variable and e-mail or post it here, so we can debug at our side.

      Thanks.

  17. by the way here the php code

  18. This is the PHP code

    $filename=$_GET[‘filename’];
    $filetype=$_GET[‘filetype’];

    if ($filename) {
    $imgbinary = fread(fopen($filename, “r”), filesize($filename));
    echo base64_encode($imgbinary);
    }

  19. I was wondering if anyone could help me.
    I have installed DLS8Setup.8.3.1.1332; still I didn’t connect the Printer.
    I wanted to design a sample label, when I try to open (DYMO Label v.8) its saying as “DYMO label requires a DYMO label printer be installed. Make sure your label printer is installed and connected”, is there any way to create label without connecting the dymo printer (But I have installed – DLS8Setup)

    thanks!
    Hasitha

  20. Hello
    We are converting our application from Access to VS2010 VB.Net

    I am trying to set up printing a label using Label Framework in VS 2010. My PC is Win 7 x64.
    I am using your sample code above
    ******
    Framework SDK (sample written in VB.NET)

    Private Label As DYMO.Label.Framework.ILabel
    Label = DYMO.Label.Framework.Framework.Open(“c:Documents and SettingsAll
    UsersDocumentsDYMO LabelLabel FilesTestLabel.label”)
    Label.SetObjectText(“TEST_BARCODE”, “9876543”)
    Label.Print(“DYMO LabelWriter 450 Turbo”)

    *********

    there is no Label = DYMO.Label.Framework.Framework.Open ……
    options when i follow your example. All I can get is Label = DYMO.Label.Framework.ILabel

    when i open a sample SKD project the code works there.
    I did add “DYMO.Label.Framework.dll assembly” to my project
    What am i missing ??

    Thanks
    Jim G

  21. Hi
    I am trying to use your VC++ command line, and although I can send a label, the address refuses to go on multiple lines, choosing to stay on one small line. This is going into an address field. Using your example: /objdata “Address=DYMO Customer 1234, Main Street, Any City, Any State, 94123” I have tried many variants to this, none were succesfull. Do I need to have a different de limiter than comma?

    The object here is to create labels from a database (Ffenics) and send one or more labels to one of several Dymo450 with several /objdata fields on the label. The only thing I cant make work is the multi line address.

    • The delimitier is “%20” e.g. /objdata “Address=DYMO Customer%201234 Main Street%20Any City, Any State, 94123″

      • Hi Thanks for reply.
        I did try the %20 so the line looked like this: /objdata “Address=DYMO Customer%20 1234 Main Street%20 Any City%20 Any State%20 94123” but it still comes out on a single line.

        • It is working just fine here. Please make sure that your .label template file can be found and is valid. You might use DLS to create a new address .label template file.

          • Hi Thanks again for reply, but unfortunately it still remains the same. I created a new .label file, changed the batch file to point to the new file, but it still prints the whole of the address in one small line :(
            Batch File:
            printlabel /printer “DYMO LabelWriter 400 on emailp34” /tray 0 /copies 1 /objdata “Address=DYMO Customer%20 1234 Main Street%20 Any City%20 Any State%20 94123” “C:Documents and Settingspaul.cheesemanMy DocumentsDYMO LabelLabelsFfenics Address.label”

          • Incase it matters, the label prints out like this:
            DYMO Customer0 1234 Main Street0 Any City0 Any State0 94123

          • Does it work when you type the entire command on a Command Prompt instead of launching it from a batch file?

          • or try

            printlabel /printer “DYMO LabelWriter 400 on emailp34″ /tray 0 /copies 1 /objdata “Address=DYMO Customer%%20 1234 Main Street%%20 Any City%%20 Any State%%20 94123″ “C:Documents and Settingspaul.cheesemanMy DocumentsDYMO LabelLabelsFfenics Address.label”

            from a batch file.

          • Horaaa! That extra % sign did the trick, now to make the full multi field one do the same!

            Thanks for your help and solving the issue :)

            Paul

  22. I want to make a barcode label via JS, but i have now continious white labels.
    has someone a sample?

  23. You’ll find some more information about printing barcodes here http://dymodevelopers.wordpress.com/tag/qr/

    Please also check your label template with DYMO Label Software (DLS).

  24. How can I print a barcode and a text description using the Barcode and Text all in one label. I am trying to print a barcode with a number and a little description describing the product that the barcode is linked to. I can print the barcode and the text together, but it is only numbers that it prints and not anything else.

  25. how stretch to label the barcode with aspect ratio?

  26. I am trying to print a PDF417 barcode using a C# application. I am printing all good. But I want to sent an Enter key into the barcode text. For example:
    “one
    two
    three”

    This is because when the barcode is scanned by a scanner later, it registers three seperate entities seperated by the enter key.

    This is my code:
    barcodeToBePrinted = barcode1 + ‘\n’ + barcode2 + ‘\n’ + barcode3;
    var label = DYMO.Label.Framework.Label.Open(“BarcodeTemplate1.label”);
    label.SetObjectText(“BARCODE”, barcodeToBePrinted);
    label.Print(BarcodePrinterApplication.Properties.Settings.Default.Printer_Name);

    This results in the printer only printing ‘barcode1″ and not the rest. What is going on? What can I do to fix that?

    • The data should be encoded correctly into the barcoded. Barcode readers do vary. Do you see the same results with various barcode scanning applications?

  27. I made this project but it seems that the printer pulls the labels back and forth multiple times until is aligned I guess (im using the 2Up 0.5 x 1 inch). But when I use the SDK VB.net application it prints the labels (same label) much much faster and one after another one. My application (based on this post) prints one label and then throws one ot two labels and print the next one… any ideas in how to improve that?
    Thanks

  28. Como referenciar em Visual Basic para os comandos abaixo funcionarem

    ‘declare diferent objects
    Dim LabObj As Dymo.LabelObject

    Dim TextObj As Dymo.TextObj
    Dim AddrObj As Dymo.AddressObj
    Dim GrObj As Dymo.GraphicObj
    Dim RectObj As Dymo.RectObj
    Dim LineObj As Dymo.LineObj
    Dim BarCodeObj As Dymo.BarCodeObj
    Dim CounterObj As Dymo.CounterObj
    Dim DateTimeObj As Dymo.DateTimeObj
    Dim TextAttr As Dymo.TextAttributes

  29. Hi, I am doing a project that uses DYMO label templates to print different types of labels in MVC3 in C#. I wanted to load and set the text for the label in the back end (controller) and then return the label to the javascript to be printed. Is this possible?
    I really want to reduce the front end code that loads and sets the label text by moving it to the back end.

    • Hi Aron, I’m not very familiar with MVC3 in C# but in concept I can not think of a reason why your idea would not be possible. Here is a link to an article that talks about Deployment on the web, it way give you some ideas on how things need to be set up in order for your idea to work.

  30. Hi – I writing a VB.NET Windows App for generating barcodes. I’ve created the template but when I try and print I get the following error: DlsRuntime Exception was unhandled / Unable to load template ‘C:\Documents\DYMO Label\Labels\vb_bCodeLabel.label’

    I have confirmed the path is correct.

    Thanks

    • Make sure that the template is correct by loading your template file from DYMO Label Software (DLS) and printing a label. Then try to load your template label and print using one of the provided sample apps (e.g. DYMO Label Framework C# Sample).

      There are certain restrictions on what characters the barcode data can contain, how long the data is, etc. Make sure the barcode data is valid for the that barcode type. You can search on here http://en.wikipedia.org/wiki/ what kind of data can barcode contain as per it’s type.

  31. Hi,
    We are just moving to the Label Framework and need to print 2-Up type labels.

    My question is :
    How do I switch the printer to print on the upper label, it seems to be always printing only on the lower label?

    • Sarma,

      Are you using a label file that was created with the 2-UP type (SKU: 30253)? Or just the standard address type (SKU: 30252)?

  32. It would be really nice if there was an updated article using the latest Dymo (not DYMO library), showing the simple printing of labels using this framework. The High Level COM dotNET sample is pretty vague on using a custom label and specifying a particular printer. Honestly, seems easier to use the old framework, but I know we’re supposed to be moving forward here… maybe a clearer example (on this blog) should be shared? What I would want is a simple, “click this button” which fires a codebehind function that, references a custom label, prints to that label passing data in. Currently I have this:

    var label = Label.Open(@”C:\myLabelDirectory\SmallLabel.label”);

    label.SetObjectText(“ProductWeight”, productWeight);
    label.Print(“DYMO LabelWriter 450 Turbo”);

    And it works fine on the old framework, but can’t figure out how to do something as simple as the above, in the new?

    Thanks

    • If you already installed new SDK on your machine, it comes with sample codes you could find.
      here is path “DYMO Label v.8 SDK\DYMO Label Framework\Samples\”.

  33. Hello. Is it possible to have a barcode object, but not have it print if no data (or a certain value) is passed to it?

  34. I am trying to get a new line in a label from vb.net but not having much luck. There are two fields, an input and a qr code. Have not been able to get a new line at all in a qr code.

    An example of the code is below:-
    label.SetObjectText(“input”, “hello” & “\n” & “world”)
    label.SetObjectText(“barcode”, “hello” & “\n” & “world”)

    Have tried \n, \n\r, vbNewLine, vbCr, vbLf, vbCrLf, Chr(13), Chr(10), Chr(13) & Chr(10) and Chr(10) & Chr(13). Most work in the input field but not the qr code.

    It is the version 8 sdk.

    Any help appreciated, thanks.

  35. I’ve been trying to print directly to our DYMO printer 400 from a website hosted on our servers using C#. I have installed the latest download on my computer – 8.5.3. I have created a label template to print to. At this point I have the following DYMO references associated with the project:

    DYMO.AddressFixer.dll,
    DYMO.Common.dll,
    DYMO.DLS.dll,
    DYMO.DLS.Neptune.dll,
    DYMO.PrinterServices.dll,
    DYMO.DLS.Printing.Service.dll,
    DYMO.DLS.Runtime.dll,
    DYMO.DLS.Runtime.TS.dll,
    DYMO.DLS.SDK.dll,
    DYMO.SmartPaste.dll,
    DYMO,WPFCommon.dll,
    DYMO.AddinUI.DLL,
    DYMOBarcode.dll,
    DYMOLabelFrameworkIDPlugin.dll,
    DYMOPrintingSupport.dll,
    DYMOScreenGrab.dll,
    DymoUniversalAddin.dll,
    Interop.AddressFixerLib.dll,
    Interop.DYMOScreenGrabLib.dll,
    Interop.NeptuneCommunicationLibratyLib.dll,
    Interop.OlTrans2Lib.dll.

    However, when I add the following line of code I still get an error telling me I’m missing a reference. It indicates that ‘Label’ does not exist in the namespace DYMO.
    var label = DYMO.Label.Framework.Label.Open(“ConferenceTemplate.label”);

    When I try to add a reference to DYMO Label Framework I get an error message telling me that it can’t be added. (The only place I can find DYMO Label Framework listed is under ‘COM’.) Message below:

    “A reference to ‘DYMO Label Framework’ could not be added. Converting the type library to a .NET assembly failed. Type library ‘DYMO_Label_Framework’ was exported from a CLR assembly and cannot be re-imported as a CLR assembly”

    Any idea of what I’m doing wrong?

    Thanks in advanced for any help you can provide.

    • Hi Arlene,

      Take a look at this and let me know if it helps:

      Problem:

      Converting the type library to a .NET assembly failed. Type library … was exported from a CLR assembly and cannot be re-imported as a CLR assembly.

      Possible Solution:

      http://stackoverflow.com/a/15511508/267702

      • Thanks for the feedback. I took a look at the article you referenced and I was about to give it a try when I tried one last thing. I searched the SDK for the dll and then browsed to it thru Visual Studio and added it to the project. It worked so I didn’t have to use the method outlined in the article.

        Thanks again for getting back to me.

  36. I have a dymo printer connected to my desktop computer and I have shared it with the server hosting the website I want to use it with. I can print labels to the same dymo printer from both my desktop computer and from the server. However when I try to print to the dymo printer from C# code I get an error message saying that it can’t find the printer.

    I’ve tried checking for printers using the following code:

    DYMO.Label.Framework.Printers p = new DYMO.Label.Framework.Printers();
    foreach (var printer in p)
    {
    sbPrinters.AppendLine(printer.Name);
    sbPrinters.AppendLine(printer.ModelName);
    sbPrinters.AppendLine(printer.IsConnected.ToString());
    sbPrinters.AppendLine(printer.IsLocal.ToString());
    sbPrinters.AppendLine(“-==========-“);
    }

    but no printers are being found.

    The desktop computer is running windows 7 and the server is running Windows 2008 R2 and IIS 7.

    Thanks in advance.

  37. I have installed latest download of DYMO .I want to give to print directly from desktop application using xojo on windows . I tried with applescript on mac it works fine.but i dont about window that how to use dymo framework in widows.

    Any idea, what should I do ?
    Thanks in advance

    • Hi Poonam,

      The DYMO SDK installer contains a folder of samples that run on Windows. That should help get you started.

      Regards,
      Jeff

  38. Hi, I have image at the folder, can you give any sample to print the image from folder in vb.net.

    For e.g. d:\images\img1.jpeg, d:\images\img2.jpeg

    I have to print based on image name to dymo labelwriter 450 turbo.

  39. How do i set the quantity of labels to be printed? I want the same label to be printed 10 times

  40. I couldn’t find how I make the GS1 escapes needed when using the “Dymo.DymoAddIn”

    Maybe someone can you provide examples on GS1 (EAN-128).

    For example:
    (01)123456x(21)00001
    x=checkvalue

    labelText.SetField(‘Barcode’, theGS1BarCodeIData)

    What I would like to understand, is the barcode setting in the template, and the the GS1BarCode data as an example.

    Cheers
    \Peter

    • Can you provide me more information about what “GS1 escapes” are? I’m not familiar with them.

      Lastly, have you checked the documentation located within the SDK installer?

    • Hi again,

      I spoke with another developer about this and got some more insight regarding your issue. Are you using VBScript? I checked the DLS SDK Manual.pdf document, and in Appendix A it says that barcode generation is deprecated and that you should use version 7 of the SDK.

      We don’t support that anymore, so if you want to work with barcodes your best bet is to create your label in the DLS application and, once you are happy with the layout, generate a label file from the application and work with it.

      Let me know if you need any more help with this.

      Regards,
      Jeff

  41. I am using the framework in ASP.NET to render a label as PNG for previewing in a web page. The preview works fine except that there are little ‘warning’ icons (yellow triangles with exclamation mark inside) at the end of some of the text fields. These icons also show in DLS 8 software when designing the label layout. Any idea why some of the text fields are displaying this icon and is there any way to suppress them from rendering?

    Thanks,
    Vince

    • The warning icons usually mean something is not quite right with what you are trying to render. You need to resolve those issues before attempting to print in order for them to go away.

  42. Do you support Python 2.7?

  43. Hi. I create an QRcode on C# . How can i send it to my label from c#

    • When using our SDK, we normally recommend creating a label with DLS and then access that label with the SDK. Creating a QR code with DLS is easy and you will have access to the QR data via the SDK.

      Hope this helps,

      Ron

  44. Hi, I recently build a visitor system in asp.net. I am trying to get the value of selected row from girdview and set it to the label text. I have tried bunch ways but all get the message “Unable to get property ‘value’ of undefined or null reference.”

    Here is my code:

    C#:

    protected void OnSelectedIndexChanged(object sender, EventArgs e)
    {

    TextBox1.Text = GridView1.SelectedRow.Cells[0].Text;
    }

    printlabel.js:

    var textbox = document.getElementById(‘TextBox1’);

    var label = dymo.label.framework.openLabelXml(labelXml);

    // set label text
    label.setObjectText(“Text”, textbox.value);

    I have tried using ClientID, add value after document.getElementById, they won’t work.

    Is anyone can help me?

    • Hi Jason,

      My guess is the label.SetObjectText has the wrong first parameter.
      http://labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/symbols/dymo.label.framework.ILabel.html

      The first parameter should be the name of the text object in the xml file, normally something like “TextObject1”.

      Ron

      • Hi Ron,

        Thank your reply.

        I am using the original printlabel.js from this Dymo blog, I didn’t change the xml file

        Landscape
        Address
        30252 Address

        Text

        Rotation0
        False
        True
        Left
        Middle
        ShrinkToFit
        True
        False

        ‘;

        So, I assume the first parameter should be “Text”, right?

        Jason

        • Hi Jason,
          In the post,a file named “FilesTestLabel” is opened, in this file there is a text object named “Text”, the label file you are using may not have an object with that name.
          Ron

          • Hi Ron,

            Thanks, I think I figure out the issue, my project was running the Javascript file before load the text, that why it always shows unable get the value.

            Jason

  45. I’m trying to print a layout in C# created with the designer.
    In the designer it prints OK.
    In C#, load the layout change value for barcode (code39) so far so good,
    when start printing an exception comes up: System.UriFormatException:’Invalue URI: the format of the URI could not be determined’

    • Are there image objects on your label? If so, make sure that the source of the image is not set to a URI. There are currently some issues creating image objects from URIs.

  46. Hi,
    i use VB in VS Expres 2015.
    I put this code :
    Private Label As DYMO.Label.Framework.ILabel
    Label = DYMO.Label.Framework.Framework.Open(“c:Documents and SettingsAll
    UsersDocumentsDYMO LabelLabel FilesTestLabel.label”)
    Label.SetObjectText(“TEXT1”, “Testing, testing”)
    Label.Print(“DYMO LabelWriter 450 Turbo”)

    But I can’t find righ Reference. Which one i must to use ?
    I tried all dll’s from dymo label folder.

  47. I’ve been having a problem lately that I hope you can help with. Lately the call to “Open()” a template file has been taking a very long time – around 15 seconds. This happens on all systems that my program is installed on. Doesn’t matter if the template is on our network share or locally in the working directory. Any logical reason why this function would take so long to execute?

  48. Can anyone tell me what yellow triangle with exclamation mark on the text object? It saud ‘Click to Modify – TEXT_3. I can not find anything on user guide…Thank you!

 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)