
Label printing in your .NET application with a DYMO LabelWriter 450
I am involved in a side project to create a minor visitor management application. One feature is to print name badges. This post is about my first experience to use DYMO:s LabelWriter 450 and their .NET SDK to communicate with it.
Choice of label printer
Internet is flooded with articles about the best choice of label printers and I have no previous experience with such printers. My choice of a DYMO LabelPrinter was a combination of price, positive reviews, nice design and a .NET SDK. Future will tell if my choice was right.
Dymo offer a couple of different LabelWriters. You can read more about them here.
I picked a LabelWriter 450 for around 70$. As usual with these printer products it is the ink and papers that cost you in the long term. Good news: The Dymo LabelWriters use thermal printing. Bad news: The printer only accepts slightly overpriced DYMO thermal paper labels. These labels come in different sizes and adhesive or not.
You can read and see more about the printer at Amazon, Dymo and Youtube.
Install printer
Let’s get started and install the printer. I am on a Windows 8 system.
All software you need can be found at Dymos homepage. You can skip the SDK installation with docs and samples for this test because the Dymo Label Software will install everything you need on your dev machine.
Steps:
- Install the Dymo Label Software (v 8.5 atm).
- Plug in the power adapter.
- Connect the printer to your dev machine with the USB cable.
- Load the labels as described in the manual.
Test Printer
Steps:
- Start the Dymo Label v8 application.
- Select correct label type. My included labels were “large address 36mmx89mm).
- Select a layout.
- Click the Print-button.
Hopefully the printer produced a label for you now.
You can read more about what you can do with the Dymo Label application at the product page. We will just use it for creating a label template in this blog post.
Create a label template
Open the Dymo Label v8 application.
- Select LabelType and use an empty layout.
- Insert one static header “Text” and two dynamic texts “Address” as showed on the image below.
- Right click on the dynamic texts, select properties and the advanced tab. Input the reference names as lblFirstName and lblLastName.
- Finally save the label template on your hard disk with the name ”LargeAddressTestLabel.label”.
.NET Application
As I mentioned DYMO includes a .NET SDK we can use to communicate with the printer. You can read more about it and see examples at dymodevelopers. I received great support from the team when asking a question about the SDK.
Steps:
- Create a WPF solution in Visual Studio (or any other .NET application of your choice. Please notice that the SDK does not support Windows RT apps)
- Include the label template file you created before in your Visual Studio project and set the copy to output directory property to ”Copy always”.
- Reference the DYMO.Label.Framework in your Project.
- Write the following code:
1234567public void Print(string firstName, string lastName){var label = Label.Open("LargeAddressTestLabel.label");label.SetObjectText("lblFirstName", firstName);label.SetObjectText("lblLastName", lastName);label.Print("DYMO LabelWriter 450");} - You can iterate the result from Framework.GetPrinters() to find out the exact LabelWriter name if you use an other model than the 450.
- Call your Print()-method from a GUI-button
- Run the application and the label printer will print a label with dynamic data.
Thats it
Conclusion
My first experience with DYMO:s label printer and SDK is good. It has been straightforward without any problems. Next step will be to design a nice label template together with a GUI and find out how the printer works for more than just a few test prints.
6 Comments
I also get “Unable to load label template ” error, when running the following code:
var Label = DYMO.Label.Framework.Label.Open(“Besokare-1.label”);
I have imported the file within the Project, did you have any solution to this?
Hej Mathias,
See my previous answer to Leo about contacting DYMOs SDK team. They answered me within 24 hours both times I mailed them a question. Plz share the solution here if you solve the problem
Hi, Can you share the soluiton? I have the same problem
Thank you
I have unfortunately not worked more with the DYMO printer since I wrote the article and have no access to a printer to test on anymore.
My advice to you is to contact DYMOs SDK team and ask your question.
To make it easier for them to help you, attach either a full code project example or at least a full class so they easy can run your example or see if u r missing any references etc. Do also mention what environment you are running on and what kind of project (WPF etc) it is.
I used this email that I think still is their support address: sdkreply@newellco.com
Plz share the solution here if you solve the problem
Good luck
/Johan
Hi Johan,
Good article on DYMO printer
.
I am getting “Unable to load label template ” error can you please help me out.
I tried with below code to load
var uri = new System.Uri(@”\Template.label”);
string converted = uri.AbsoluteUri.ToString();
var label = DYMO.Label.Framework.Label.Open(converted);
No dough on file location, issue is something else. Please try to help me out.
Thanks In Advance.
Sent you an answer via mail
/j
Email
Skype
LINKEDIN
Follow me
Current Position
- Homepage
- Blog
- Øredev conference
App Developer at Metro Kings>
Twitter: jsilfversparre
Categories
Tags
Archives
Search