Oct 072011
A new version of DYMO Label Framework JavaScript library is available.
This version adds support for Opera 11.51 on Mac and Windows.
The js script file is available from http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.2.4.js.
The http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js has been updated to version 1.2.4 as well.
Can you provide a secure link to the javascript framework? I link to the lastest version (http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js) in a secure area and i get a mixed content warning. I know i can just download it and link to my server, but i would rather link to a CDN so that i don’t need to continually update the version on my server.
Sorry, we don’t provide https hosting. Also, I would discourage you from usage the .latest version and load it from labelwriter.com as well. We are doing a lot of testing before we publish the next release, but it still might be undiscovered bugs can break your application. It will be much safer for you to manually grab the new version, test your app with it and then use it on production. Also, our hosting server, labelwriter.com, is not 100% fault tolerant. If you host the js on your site, you don’t have an external dependency.
I’m having trouble getting the SDK to work in Chrome. It works in Firefox and IE on the same computer, but when I try Chrome, I get two messages: one that no DYMO printers are installed and the second one says I don’t have the framework installed.
Figured it out. Although I was restarting Chrome, it was leaving a process open in the background. Once I got all processes closed and restarted Chrome, it worked. Now down to developing!
I have an issue with creating a carriage return. I’m using .net and in the code behind page I generate the text that will be used to print the label. to get a carriage return i use Environment.NewLine. This works in most situations, but sometimes the newline is just ignored. i haven’t been able to figure out why. is anyone aware of this issue? is there a better way to do a carriage return? when i use n, the characters “n” are printed instead of a carriage return.
Could you provide the code you are using?
Any line end combinations should work, ‘n’, ‘r’, or ‘rn’. Here is the sample
Three lines will be printed:
DYMO
828 San Pablo Ave
Albany CA 94706
i have an aspx page that dynamically generates text for a receipt. i store that text in a hidden field. then when the print receipt button is selected, i call the javascript function that sends the information to the dymo printer (LabelWriter 450 Turbo). in the aspx code page i use environment.newline for a carriage return (which according to microsoft’s site should just convert to “rn”).
The javascript code I am using is:
var label = dymo.label.framework.openLabelXml(getLabelTemplate());
var labelSet = new dymo.label.framework.LabelSetBuilder();
var record = labelSet.addRecord();
record.setTextMarkup(‘TEXT’, ‘text here’);
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0)
throw “No DYMO printers are installed. Install DYMO printers.”;
var printerName = “”;
for (var j = 0; j < printers.length; ++j) {
var printer = printers[j];
if (printer.printerType == "LabelWriterPrinter") {
printerName = printer.name;
break;
}
}
label.print(printerName, null, labelSet.toString());
After more testing i discovered that the problem seems to be related to when i use "” to change the font size. when i use these tags back to back (two paragraphs that need different font sizes), the problem occurs. if i remove one set of font tags, then the problem goes away.
seems like the text markup you are using might be invalid formatted. You could use http://labelwriter.com/software/dls/sdk/samples/js/TextMarkup/TextMarkup.html and paste the text your backend generated into “TextMarkup:” field to try.
Also, because you are using text markup feature, you can encode new lines as ‘br’ tag
Thanks, using “” worked.
I meant <br />
I can’t seem to find any documentation on this so I apologize for a newbie-ness that follows.
I have a web app (LAMP/AJAX driven) for our company that tracks boxes of product for internal use. I have a page where I add a box to a category. That box gets a unique ID. I would like to print a barcode label for a box where the barcode is the unique ID. I currently have a PHP script that takes the number and creates a JPG of a barcode based on any number that you give it. i was hoping to be able to use this to generate an image that would be put onto a label for printing.
I know how to pull the ID from the database and display it, store it, do whatever with it. But I don’t know how to get the image into the Dymo javascript library. I’m new to this library. Allmost all of the examples are all about displaying/formatting text. I think I could handle sending the script some text. But the parameters for sending it an image are a mystery to me. Unless the script can take a number and dynamically generate the barcode image all by itself…
Thanks in advance.
You can print barcode as an image. A sample to setting images can be found here, http://labelwriter.com/software/dls/sdk/samples/js/VisitorManagement/VisitorManagement.html Basically the image should be a base64-encoded string contains the image data. You set the data by using label.setObjectText() or by using labelRecord.setBase64Image.
Also, you can print a barcode as a barcode by providing just a text data for it. Here is the sample http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintBarcodeLabel/PreviewAndPrintLabel.html. In this case the code is the same as for any text samples, only the label template is different.
Vladimir – thanks for that. I was able to get it to do some reverse engineering and get it to work. It’s ugly, but functional for now!
My next question is this; how do I tell it how many copies of the label to print?
Also, I managed to find the classes documentation which was very helpful (though hard to find). Is there a central page that links to all of the documentation for all of the classes and functions that makeup the framework library? I’ve learned a lot by trial and error, but I’d love to have a resource to click through or search. Thanks again.
The documentation for the JavaScript library is here http://labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html
As for multiple copies – pass printParams as a second parameter to print, like:
label.print(‘DYMO LabelWriter 450’, dymo.label.framework.createLabelWriterPrintParamsXml({copies:1}));
Is there not a website or page that has up to date information on the JavaScript API and usage information?
We are in process of updating the SDK installer that will contain some of JS samples. But what is wrong with the blog and web docs?
I was hoping to find a little more on how to get started from nothing.
The blog has a lot of information. Start by installing the latest DYMO Label software, then read following posts:
Announcing DYMO Label 8.3
DYMO Label Framework JavaScript Library Documentation
DYMO Label Framework JavaScript Library 1.2.4
DYMO Label Framework JavaScript Library Samples: Print a Label
DYMO Label Framework JavaScript Library Samples: Label Preview
DYMO Label Framework JavaScript Library: Print Multiple Labels
Label Printing and Web Deployment
If you have a specific question, just ask on the blog or send an e-mail to [sdkreply at newellco com]
That’s very helpful. Thank you!
There’s a small bug between the Mac and Windows implementation. I have a template file with an Image placeholder, but I deleted the image data between the image tags in the XML file so as not to take up space for an image that may or may not be set with setBase64Image(). On Mac this is no problem. On windows it complains that the template file could not be loaded. The solution is to insert a 1 x1 pixel transparent image as a place holder. It won’t show if printed and can be replaced with setBase64Image when a real image is needed.
What’s the best way to insert an image from a website? Here’s my example linking to the Google logo. When I print it out it just shows blank. Am I missing something?
Landscape
Address
30252 Address
Image
Rotation0
False
False
http://www.google.com/intl/en_ALL/images/logo.gif
Uniform
0
Left
Top
Whoops it removed my code. I’m using the ImageLocation tag which I found on http://developers.dymo.com/2010/03/24/understanding-label-file-formats-in-dymo-label-v-8-label-objects/
Hi there,
What would cause labels to print out like this?
All my other customers have been able to print fine using the same software. Could it be the type of label they’re using?
Thanks
Ben
Please forward your questions regarding the SDK to the e-mail mentioned in the following blog post http://developers.dymo.com/2011/10/12/sdk-troubleshooting-tips/
Thank you! Shall do :)
Hi guys,
I’m experiencing some Dymo printer detection with Windows 8 (and FF16 but work on W7/FF16)
Do anyone get printer detection problems since migrating to W8 ?
Many Thanks !
There has been a new DLS release for users who have moved to Windows 8. The new DLS version can be found here download.dymo.com/software/win/dls842setup.exe
Great ! Thank you !