Hello everyone!
As promised, this is the second post in the FAQ series. Today, we will be getting a bit more technical and diving into some questions regarding SDK code. Let’s get started!
1. I am trying to create a label with several objects but this seems difficult to do using the SDK APIs. I feel like I am creating my label the wrong way. How should I be creating my label using the SDK?
Although it is possible to layout a label entirely using our APIs, we recommend that you first create your label using DLS and then load this label with our API. For most SDK applications this approach should work well as it will reduce the amount of code for creating the label as well as allow you to edit the data on the label based on any user inputs. For instance, let’s say your were making an application that would create name badges for a conference your company was hosting. You could create a label in DLS with two text fields: one for name and one for company. Then, as attendees arrived at your conference registration table, you could simply type in the name and company of the attendee and your application would update the data on the label using our APIs and print out the name badge. See the code samples below to learn how to load the label and update the label data using both the older SDK and newer Framework. For the purpose of these examples, assume your label was named “NameBadge.label” and your name and company text objects were named “NameTxt” and “CompanyTxt”, respectively.
DYMO SDK
|
DYMO Label Framework
|
DymoAddInClass _dymoAddin = new DymoAddInClass();
DymoLabelsClass _dymoLabel = new DymoLabelsClass();
_dymoAddin.Open("NameBadge.label");
_dymoLabel.SetField("NameTxt", "John Smith");
_dymoLabel.SetField("CompanyTxt", "Newell Rubbermaid");
_dymoAddin.Print(1, false);
|
var label = DYMO.Label.Framework.Label.Open("NameBadge.label");
label.SetObjectText("NameTxt", "John Smith");
label.SetObjectText("CompanyTxt", "Newell Rubbermaid");
label.Print("DYMO LabelWriter 450 Turbo");
|
2. Every time I print to my Twin Turbo the label prints from the left tray. How can I print to the right tray?
Changing to the right (or second) tray is relatively simple in both the SDK and the Framework. However, it may be difficult to find this setting without knowing where to look. In the SDK, you simply specify a tray number (an integer) to indicate which tray to print to. You will use the Print2() method instead of Print(). In the Framework, there is an enum you use in conjunction with the LabelWriterPrintParams class. See the examples below.
DYMO SDK
|
DYMO Label Framework
|
_dymoAddin.Print2(1, false, 1);
The third parameter in the line above indicates
the tray number to use.
|
LabelWriterPrintParams p = new LabelWriterPrintParams();
p.RollSelection = RollSelection.Right;
label.Print("DYMO LabelWriter 450 Turbo", p);
|
3. How can I create a tape (continuous) label using your SDK?
To create a continuous label, you must use the DYMO Label Framework. The older DYMO SDK does not support continuous labels. The layout mechanism of a continuous label is quite different than that of a die-cut. A continuous label uses a cell layout system instead of the fixed location system of a die-cut label. For example, if you were using a die-cut label and wanted to place three text objects side-by-side-by-side, you would manually set the location (x,y coordinates) of the three objects on the label.

However, for a continuous label, you would need to add three subcells to the root cell of the label and then insert each of your text objects into one of the cells.

Continuous labels are the simplest way to create a label on the fly. Continuous labels automatically size to their content (unless otherwise specified) and provide an organized layout system. Below is some sample code illustrating how to create the label displayed above using the DYMO Label Framework and continuous labels.
ContinuousLabel label = new ContinuousLabel("Tape9mm", PaperOrientation.Landscape, ContinuousLabelLengthMode.Auto, 0);
label.RootCell.Subcells.Add(new ContinuousLabelCell());
label.RootCell.Subcells.Add(new ContinuousLabelCell());
label.RootCell.Subcells.Add(new ContinuousLabelCell());
label.RootCell.Subcells[0].LabelObject = new TextObject("Txt0");
label.RootCell.Subcells[1].LabelObject = new TextObject("Txt1");
label.RootCell.Subcells[2].LabelObject = new TextObject("Txt2");
label.SetObjectText("Txt0", "This");
label.SetObjectText("Txt1", "is a");
label.SetObjectText("Txt2", "test.");
4. I would like my application to interface with a DYMO scale. Is there a DYMO scales SDK?
We do not provide an SDK for DYMO scales. Our scales conform to the HID standard and can be accessed this way. The HID standard for scales is documented in section 4 of this document. Jan Axelson has a useful page on HID development with plenty of examples. Nicholas Piasecki and Mike O’Brien also provide some useful resources on HID scale development.
That wraps up this second FAQ post. Hopefully all of you developers found these posts useful and continue to use our SDK and our printers. I hope everyone enjoys the rest of this holiday season and has a happy New Year!