This blog post will show how easy is to add label printing capabilities to your web application. This is possible because of the JavaScript library that is a part of new DYMO Label Framework.
Prerequisites
To be able to use the library DYMO Label software should be installed on the client machines. On Windows version 8.3 or later is required. Version 8.3.1.1332 is available on http://download.dymo.com/download/Win/DLS8Setup.8.3.1.1332.exe On Mac version 8.2.2.1173 or later is required. Version 8.2.2.1173 is available on http://www.labelwriter.com/software/dls/mac/DLS8Setup.8.2.2.1173.dmg
The Sample
The complete sample is available on http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html
The code in the sample is in http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.js
The sample is minimalistic. It just contains a text area element to specify a text to be printed on a label and a button that triggers printing.
DYMOLabelFramework.js
The first thing should be done for any web project that uses the Framework is to include the library’s code, so it is available for scripts on the page. It is done like this:
<script src="http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js" type="text/javascript" charset="UTF-8"> </script>
This will include the latest version of the library. The only other hosted version for now is http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.1.0.beta.js
In the future other versions will be available as well. It is OK to host the file on your own web-server.
Print a Label
All printing code is in the printButton.onclick event handler assigned in PrintLabel.js. The print task contains three major steps: specifying label layout to print, setting data to print, selecting printer to print on, and actual printing.
Specify Label Layout to Print
Before a label can be printed we should specify what is the label, what objects it contains, what are their positions, etc. It is done by “opening” a label. The easiest way is to put the xml string describing the label right into openLabelXml() function. The easiest way to obtain the xml is to design the label using DYMO Label software, saving it into a file, then pasting file content into the js code.
var labelXml = ' <DieCutLabel Version="8.0" Units="twips"> <PaperOrientation>Landscape</PaperOrientation> <Id>Address</Id> <PaperName>30252 Address</PaperName> <DrawCommands/> <ObjectInfo> <TextObject> <Name>Text</Name> <ForeColor Alpha="255" Red="0" Green="0" Blue="0" /> <BackColor Alpha="0" Red="255" Green="255" Blue="255" /> <LinkedObjectName></LinkedObjectName> <Rotation>Rotation0</Rotation> <IsMirrored>False</IsMirrored> <IsVariable>True</IsVariable> <HorizontalAlignment>Left</HorizontalAlignment> <VerticalAlignment>Middle</VerticalAlignment> <TextFitMode>ShrinkToFit</TextFitMode> <UseFullFontHeight>True</UseFullFontHeight> <Verticalized>False</Verticalized> <StyledText/> </TextObject> <Bounds X="332" Y="150" Width="4455" Height="1260" /> </ObjectInfo> </DieCutLabel>'; var label = dymo.label.framework.openLabelXml(labelXml);
In a real web application you would probably load the label definition xml from the server using some AJAX library instead of specifying it directly in a js file.
Setting Data to Print
The next step is to specify data to print on the label. This is easy:
label.setObjectText("Text", textTextArea.value);
The code sets the content for the object named “Text” to whatever is typed in the text area field on the page. Note: the library supports setting formatted/styled text as well. This ability will be reviewed in a different blog post.
Selecting the Printer to Print on
The printer should be selected from a list of installed printers. For this sample we choose the first LabelWriter printer:
var printers = dymo.label.framework.getPrinters(); if (printers.length == 0) throw "No DYMO printers are installed. Install DYMO printers."; var printerName = ""; for (var i = 0; i < printers.length; ++i) { var printer = printers[i]; if (printer.printerType == "LabelWriterPrinter") { printerName = printer.name; break; } }
Actual Printing
If the printer name is known the printing is simple:
label.print(printerName);
Conclusion
As you can see, label printing is not hard if DYMO Label Framework is being used. The Framework has a lot of other useful features, like multiple label printing, specifying image data for a label, specifying text styles, etc. These features will be reviewed in later posts.
Great work, I like the direction this is headed! A few comments though: I think you should consider using JSON instead of XML. It is a much easier format to work with in JavaScript, lighter weight, and a format most web developers are much more familiar with. I also noticed the framework JavaScript file contains quite a bit of XML utility functions that could probably be simplified or removed all together if JSON were used. I didn’t study the code too closely, but if the XML format is needed, it would probably be easier to process the data in JSON and then later serialize it to XML rather than messing with XML the whole time.
I look forward to seeing further development of this framework!
Thanks
-MH
Thanks for the comments and suggestions. We might add JSON support in the future. As for now, couple of words in defence of Xml :)
I also would like to use this framework, however, a few words on your defense of xml.
On your first bullet. If I was inclined to store files serverside, I would not store them in XML. I don’t agree how this is a justification for XML or use of XML in javascript. Even if I was forced to save files as XML, I would much rather have a service on the server to convert to JSON than convert client side or also save a JSON copy. Another approach is if these files are small and static, you could have a package manager where the consumer of your lib can pre package them saving hits on your servers.
On your second bullet I will refer you to http://www.json.org/fatfree.html . JSON is very robust.
On your third bullet. This is why you use JSON, so you don’t need to depend on a js lib like jQuery for xml support. You would be able to slim down your code to make it more simple if you would not use xml. Your sorta proving Mikes point with this statement :D. My simplification of your third point is “most of the code we added is to support XML” which seems odd.
your points are valid. Just don’t forget, we have to support a variety of platforms and tools, and having two complex transport formats is a little overkill at present point. And for most developers XML is more familiar, even though you don’t usually work directly with it from SDK. From bandwidth point you can always use a compression. And even for JSON you do need external libraries to support older browsers.
Just tried this but getting incorrect label format when pressing print even If I copy the sample app any ideas?
Could you provide more information about what exactly does not work? Did you try ? Does it work? If yes, then try to find a difference in your code.
Hi Vladimir,
Very werid did some more comparing and it seems by adding charset=”UTF-8″ onto both the external javascript files it fixed the issue!
The good news it’s working great on the PC now however the bad news we are deploying this label printer on a Mac OS X 10.4 computer (tester it on 10.5 though). It does seem to through up unsupported function when using Sarafi for GetPrinters() so I commented out that block of code and hardcoded it to label.print(“DYMO LabelWriter 450 Turbo”); but still get the same issue.
How can we run this on the mac? (ideally firefox but Sarafi would be fine too), we are running the latest dmg image for mac os x listed above too.
Thanks,
Chris
What is exactly the error? Could you attach/e-mail system debug messages using Console utility? vbuzuev at dymo dot com
I had the same problem as chris, when i tried to print on mac os x 10.4 the print job would appear with the correct name “Dymo LabelWriter 450” but never print… chris was on the right track with hardcoding the name but i found that when you go to printer utilities and double click on the dymo labelwriter the name for mine (Dymo LabelWriter 450) was instead “LabelWriter 450” once i hardcoded this name into the script it worked fine! hope this helps someone else
Can you shed some light on why Safari is the only supported browser on the Mac? I have a target application for the javascript framework on Macs, but the browsers are Chrome and Firefox…
There are plans to add Firefox/Chrome support on Mac in the upcoming DLS 8.3 release. But there is no guarantee…
Ok, thanks for the update.
I’m using the new javascript interface, and am able to successfully print labels through Safari on MacOS 10.6 on a Labelwriter Duo. However, the print quality on the labels varies…often there are light vertical lines though the text and graphics. Sometimes the label prints much more slowly than other times.
I am passing in the params for ‘BarcodeAndGraphics’ print quality, but it doesn’t seem to help any.
Print quality is similar when I print through the regular Dymo label designer app.
Suggestions?
Thanks.
The print speed is different for BarcodeAndGraphics and Text (default) modes, so it is expected. As for the vertical lines – could you send the label file you are printing? and maybe a images of the printed labels? Could you print the same file from Windows? is the quality the same?
Just a quick question, as I am about to test this but it may save me some time. The first paragraph says “…DYMO Label software should be installed …” Does this mean that you don’t need to have it installed? IE, if I plug in my dymo and just install the driver, will I be able to print a label to it with the javascript framework?
No, DYMO Label software must be installed.
It’s working fine on my computers (windows & mac). I have two customers testing it and both seem to be hanging at “var printers = dymo.label.framework.getPrinters();”
btw – both could print using the non framework method with the addin activex.
They are both on Windows XP with modern versions of IE. They are both on school district owned computers with tight security if permissions might be an issue.
Any ideas or direction on how to diagnose this? Can I catch the error with try/catch?
make sure the customers have beta version of DYMO Label software 8.2.3.1026 installed.
That’s it? The beta 8.2.3.1026 or higher installs the framework on the client?
Is that for windows only? I ask because I didn’t install a beta on my mac that is working. I just grabbed 8.2.2 for the Mac of your site, apparently it installs the framework?
from DYMO Label Framework Overview:
All needed libraries and binaries are installed by DYMO Label v.8 installer. On Windows you will need to install version 8.2.3.1026 or later available on http://www.labelwriter.com/software/dls/win/DLS8Setup.8.2.3.1026-BETA.exe. Note: THIS IS A BETA VERSION for developers only. Please don’t install it on customer’s machines. On Mac DYMO Label version 8.2.2.1173 or later should be installed. It is available on http://www.labelwriter.com/software/dls/mac/DLS8Setup.8.2.2.1173.dmg. Documentation and samples are installed by DYMO Label SDK installer available on http://www.labelwriter.com/software/dls/win/DYMO_Label_v.8_SDK_Installer.8.2.3.123-BETA.exe.
OK, so this isn’t ready for use on client’s machine yet. Then, I’m back to embedding the DYMOLabelPlugin in Safari on the Mac. And this brings me back to my original question, how do you open a template file from a url in Safari on Mac? Is there comparable method to ‘openUrl’ we use in windows? I can’t find it on the mac version. I need this now for a client. I guess I misunderstood and thought you were suggesting the framework as the solution I need.
You can install it on clients we just don’t recommend it (build 1026 is pretty stable but was not tested by QA). Just don’t forget to update to upcoming “production” version of DYMO Label 8.3 in a week or so. If you cannot wait, then possible there are two ways. First is to use your original code on Windows, and the Framework on Mac. Otherwise, call Safari plug-in directly by using openLabelFile(uri) function.
How do you specify the tray number to print to using Javascript for a LabelWriter 450 Twin Turbo? I cannot find any samples that explain this syntax. Thanks!
It can be done by specifying the tray/roll in print parameters object. Something like
var printParams = {};
printParams.twinTurboRoll = dymo.label.framework.TwinTurboRoll.Auto; // or Left or Right
then pass the printParams to print method like
label.print(printerName, dymo.label.framework.createLabelWriterPrintParamsXml(printParams));
This worked well for me cheers!! but one more question , How would I specify the number of Copies to printed in the Print method???
It can be done by specifying the copies in the print params:
var printParams = {};
printParams.copies = 2
Then you can pass the printParams to the print method like:
label.print(printerName, dymo.label.framework.createLabelWriterPrintParamsXml(printParams));
You can find the documentation here:
http://labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/symbols/dymo.label.framework.html#.createLabelWriterPrintParamsXml
Verry nice feature! Saves me a lot of time :-)
Very curious about how I can add an image to the labels.
if you image is static (not needed to be changed for every label printed), then the easiest way is to edit a label file using DYMO Label software, then you can load the label file in your java script code using openLabelFile() or openLabelXml(). If the image is dynamic then you can use dymo.label.framework.loadImageAsPngBase64() to load image from a local file or url. The returned string can be passed to label.setObjectText. loadImageAsPngBase64() has one drawback – it is called synchronously, so if it is used to load an image from an url and the site is down the application/browser will “hang” for a while. so, the better way is to load it asynchronously from the server using Ajax and then pass to setObjectText or labelSetBuilder.addRecord().setBase64Image(). Just note, that the image data should be rturned by the server as png base64-encoded string.
Here is a sample.
Thnx for this example by the way :-)
I’m just trying to build a web page or touch screen app that prints a saved label when an icon on the page is clicked or touched using touch screen. I don’t need to input text into the label just print it. each icon would represent a different label to print.any suggestions.
Just call openLabelXml() and then label.print(). One note though – currently the library is supported on Windows and Mac only.
can you give me an example? I dont code much (ever) say the filename is c:45×45.label what would I script and how can I tie that to a button on the web page.
assuming that the label file is on the web server in the same folder as the html file, the printer name is “DYMO LabelWriter 450 Turbo”, and you are using jQuery, the code would be
printButton.onclick = function()
{
$.get('45x45.label', function(labelXml)
{
var label = dymo.label.framework.openLabelXml(labelXml);
label.print(“DYMO LabelWriter 450 Turbo”);
});
}
makes sense and I’m sure it will work but I’m limited to Dreamweavercs3, visual studio 2008, and publisher 2007, and you guessed it not a lot of skills in any of them. but hopefully I can pass this code on to a web dev that can figure out how to make a square area on a web page print the labels. thanks, TS
If you try to print a label containing the character ‘&’, an error wil apear. It seems that HTML entities aren’t converted or something. Maybe a solution would be to convert these special characters(?)
could you provide an example when it does not work? Are you using the latest js from the labelwriter.com?
Thanks,
Vladimir
Hi Vladimir,
Yes, i use the latest version. The error i get:
“Error calling method on NPObject! [plugin exception: Unable to load label template].”
This is when i use an ‘&’ char in the label.
Other question (maybe for other forum): I’m also intrested in the CardScan-product from Dymo, does this product also have an API so i can convert the data from a business card into my own CRM?
How do you put ‘&’ on the label? Could you provide a code sample? Are you loading dymo.labek.framework.js from our url? If yes, whitch one? (Just to make sure you are using the latest version)
Where can i find the API for the SDK.
Right now, the only documentation available is the samples on the blog. Official documentation will be released in coming weeks. Current samples cover most functionality. If you have specific questions, just ask.
here is my requirement.
I am working with a java web application.
The application background process will generate the label data along with the barcode in code128.
The generation of the barcode should be a background process and should be hidden from the user(the ones that are connected to the printer). The value of barcode will depend on the user actions on the front end.
I am using javascript/jquery/ajax tools.
I want to use a standard label template for code 128 and store that template on the server. I want the dynamic label data to be populated into this template and then print action to take place on the client side.
Please guide me. Appreciate your help.
You don’t need to modify the label template on the server. Just design it using DYMO Label software, assign a name for your barcode object (default is ‘BARCODE’), save it (say ‘Barcode.label’) and put on your web site. Then you can set barcode data and print a label on the user machine using following code snippet.
Vladimir
Thank you for your help.
If you could provide more insight line by line of the code provided above $.get(…) would be much appreciated.
I wonder if we can download style sheet PreviewAndPrintLabel.css for the sample example provided, that would be great too as I am trying to set up this PreviewAndPrintLabel example in my Java development environment eclipse and because css is not there, I am not getting to see the actions on the page.
Appreciate your help.
Thanks
Durga
yes, you can download css, all sample code is in public domain.
I read the comments in this forum and understood what is happening inside the $.get(…). and Thanks to your descriptive clarrifications.
I found only html and js files for the sample PreviewAndPrintLabel. Could you pls. tell me where is css provided for the download.
One thing that I am still not clarified is when a label template is designed, created and placed on the server, why, The SDK installation is required on all the client machines that are connected to their respective printers.
http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.css
Could you provide the images that are referred by css. I appreciate.
when there is no absolute path in html/css, resources are loaded from the base url that is in this case http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/
so, the image urls are
http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PrintButtonNormal.png
http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PrintButtonHover.png
http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PrintButtonDisabled.png
http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PrintButtonPressed.png
Also, you can use any bulk site loaders to grab all the files at once
I copied all the button images.
I am not able to input the text in the current address text area and also not able to see any label preview.
Could you pls. tell me if I have to do any additional steps to make the sample to work as a complete application on my local machine. Appreciate your help
addressDiv is not found in css. Is there any other css that this sample is refering to.
DYMO Label software 8.3 has to be installed on your machine. A DYMO LabelWriter printer should be installed as well. A full sample including all necessary files is included with DYMO Label SDK
I have installed the SDK 8.3 and attached 2 dymo printers to my computer.
I am not able to see the label preview and not able to input anything in the text area provided
any thoughts??
one of the printers is dymo 450 and the other is dymo 400 both are label writers
open http://labelwriter.com/software/dls/sdk/samples/js/CheckEnvironment/CheckEnvironment.html
click Check button. What is the output?
does http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.html work?
the sample you provided printLabel is working just fine on my local.
I am working with previewandprintLabel example you provided because it is similar to what I have to do
click Check button. What is the output?
isBrowserSupported: true
isFrameworkInstalled: true
errorDetails:
does http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.html work?
yes it does work
I could print labels.
so, start with http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.html and modify it for your needs…
I think you used a wrong js file from another sample. Use this one http://labelwriter.com/software/dls/sdk/samples/js/PreviewAndPrintLabel/PreviewAndPrintLabel.js
also, check your Browser console/output window for any errors in your javascript
Vladimir,
I Thank you alot for the help you have provided. Now, I could print the bar code labels from the application that I have created in java environment. I tried to print bar code from a different computer on the network that do not have SDK installed by accessing the application I had created on my server. The remote computer has printer connections and drivers installed but no SDK. It did not print. I ask you again, is the SDK mandatory on all the cliets to be able to print from a web server application? Pls. confirm
Thanks,
Durga
As for now, not SDK, but DYMO Label 8.3 has to be installed on each client machine.
Hey, great post!
Is there a way to print to a client’s DYMO printer without requiring the SDK installation be installed on all the client machines? Say, I want to print a very simple label – just a barcode and some text underneath (default colors; 3of9).
As for now, DYMO Label 8.3 has to be installed on each client machine.
Related question: is there a way for Dymo to print directly from .doc (or .docx) as opposed to printing from a .label file? How about from an html div? I noticed my LabelWriter 400 Turbo can print from a .txt file (even though it orients it horizontally by default…)
Answering my own question: yes. You simply have to select the correct orientation and paper size from the print dialog in Word. The advanced options for the DYMO printer make this easy.
Hi, when I try out the sample page at http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html in IE9, I get the following error when I click the Print button:
XPath not supported by this browser.: TypeError: Object doesn’t support property or method ‘selectNodes’
I tried downloading and installing IE9 again but the error remains. Any idea if this is a common issue and so I should not allow IE9 users to try to print labels from my website? Otherwise the JS library works great with all the other browsers I’ve tried. Thanks!
OK, there is a problem with IE9. We will look into it but for now you could try following workarounds:
Instead of calling label.setObjectText() use a label set. E.g. for the sample, the code will be changed from
to
for more information about label set API see here
Ok thanks, I’ll give labelset a shot =)
I have a question on this example.
I have successfully altered the original example above to have 6 text fields (all in one row) in a table. The label will print correctly with all 6 fields.
My question is that I would like to have multiple rows in my table with a print button at the end of each row. Currently when I try to add more rows – only the first row remains functional.
Any suggestions?
Hi,
It is not clear about what rows you are talking about. Could you be more specific? What is the goal, could you provide a sample data and how it supposed to be printed?
The Goal is to have a materials log in sheet with the ability to print off a label as each item is entered. Something similar to a delete row function – where only the chosen row is affected or used when the button on that row is clicked. I plan to have an add rows function to add new blank rows dynamically using javascript – which I have found a script to do so. This is the table structure – only showing 2 rows of possibly many:
Customer:
Sidemark:
Vendor:
Description:
Quantity:
Received On:
Print
Customer:
Sidemark:
Vendor:
Description:
Quantity:
Received On:
Print
As I noted in my first post. I can get one row to work using the original javascript file – adding in my multiple variables instead of just one in the sample. I just don’t see how to isolate one row and send only that info at time of click on the desired row. Possibly load the values from the desired row into an array then load into the javascript function?
I appreciate any help or ideas you may be able to provide.
The Goal is to have a materials log in sheet with the ability to print off a label as each item is entered. Something similar to a delete row function – where only the chosen row is affected or used when the button on that row is clicked. I plan to have an add rows function to add new blank rows dynamically using javascript – which I have found a script to do so. This is the table structure – only showing 2 rows of possibly many:
table border="0"
tr
td Customer: /td
td input type="text" name="customer_name" id="customer_name" size="15" / /td
td Sidemark: /td
td input type="text" name="sidemark_name" id="sidemark_name" size="15" / /td
td Vendor: /td
td input type="text" name="vendor_name" id="vendor_name" size="15" / /td
td Description: /td
td input type="text" name="description" id="description" size="15" / /td
td Quantity: /td
td input type="text" name="quantity" id="quantity" size="5" / /td
td Received On: /td
td input type="text" name="date_recd" id="date_recd" size="10" / /td
td button id="printButton" Print /button /td
/tr
tr
td Customer: /td
td input type="text" name="customer_name" id="customer_name" size="15" / /td
td Sidemark: /td
td input type="text" name="sidemark_name" id="sidemark_name" size="15" / /td
td Vendor: /td
td input type="text" name="vendor_name" id="vendor_name" size="15" / /td
td Description: /td
td input type="text" name="description" id="description" size="15" / /td
td Quantity: /td
td input type="text" name="quantity" id="quantity" size="5" / /td
td Received On: /td
td input type="text" name="date_recd" id="date_recd" size="10" / /td
td button id="printButton" Print /button /td
/tr
/table
As I noted in my first post. I can get one row to work using the original javascript file – adding in my multiple variables instead of just one in the sample. I just don’t see how to isolate one row and send only that info at time of click on the desired row. Possibly load the values from the desired row into an array then load into the javascript function?
I appreciate any help or ideas you may be able to provide.
yes, you should have a “data model” from witch you populate UI/html as well as get data to be printed.
Thanks very much for the reply, but I’m not exactly sure what you are trying to say. Does that mean you agree with my thought about loading the data into an array first then calling the javascript print function?
first, create a ‘print’ function that takes all needed data to be printed as parameters, e.g.
function printLabel(params)
{
var label = dymo.label.framework.openLabelXml(...);
// set label data using 'params'
// ...
// print
label.print(...);
}
in the code that generates rows for the table you can do something like this:
function addNewTableRow(args)
{
// add row elements
// ....
// add print button
var printButton = ;// call dom to create a button element
// populate needed params for the print function
var params = {}
params.firstName = 'John';
params.lastName = 'Smith';
// attach event handle that will call print label
printButton.onclick = function() {printLabel(params);};
}
I made a kiosk web page and a touch screen when you touch a java enabled object it prints a label file my problem is a 4-5 second delay between touching the screen and printing the label. any idea how to minimize the delay
could you provide a code snippet for the printing? As general suggestions:
– make sure there are no network communication when user clicked the print button. E.g. the label file and all label data should be downloaded already.
– if printing from Windows, the first print job might take several seconds before actual printing starts. This is because printing system libraries have to loaded. Subsequent print jobs will be fast because the system libraries are in RAM/file cache.
how can I post code it I paste it and post comment but see nothing there.
/div
div id=”content”
div id=”table_linen”
h2 Table Linen /h2
div id=”labels”
div class=”qty” Quantity /div
div class=”size” Size /div
/div
div class=”buttons”
a href=”javascript:printLabel(‘tl_20045045’);” onclick=”printLabel(‘tl_20045045’);returnEvent = false; return false;” class=”button”
span class=”qty” 20 /span
span class=”size” 45×45 /span
/a
a href=”javascript:printLabel(‘tl_20054054’);” onclick=”printLabel(‘tl_20054054’);returnEvent = false; return false;” class=”button”
span class=”qty” 20 /span
span class=”size” 54×54 /span
What is printLabel()?
the the name of the label file to be printed tl_20054054.label
OK, but how printLabel() is implemented?
function getPrinter(){
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0){
console.log(“No DYMO printers are installed. Install DYMO printers.”);
return false;
}
var printerName = “”;
for (var i = 0; i < printers.length; ++i)
{
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}
if (printerName == ""){
Console.log("No LabelWriter printers found. Install LabelWriter printer");
return false;
}else{
return printerName;
}
}
function printLabel(id,file){
var env = dymo.label.framework.checkEnvironment();
if(env.isBrowserSupported==false){console.log(env.errorDetails);return false;}
if(env.isFrameworkInstalled ==false){console.log(env.errorDetails);return false;}
var printer = getPrinter();
if(file == false){
var labelURI = "http://localhost/labels/labels/default.label";
var label = dymo.label.framework.openLabelFile(labelURI);
label.setObjectText("TEXT_1", id);
console.log('good so far');
console.log(label.getLabelXml());
label.print(printer);
}else{
var labelURI = "http://localhost/labels/labels/"+id+".label";
console.log(labelURI);
var label = dymo.label.framework.openLabelFile(labelURI);
var success = label.print(printer);
if(success==true){
console.log('printed');
}else{
console.log('failed');
what is the delay/time execution for the whole printLabel(id, file)?
what is the delay/time execution for the the call of label.print() inside printLabel()?
every tiem printLabel() is called the label file is loaded from “http://localhost/labels/labels/”+id+”.label – this might be a source of the delay.
as specified in openLabelFile documentation, openLabelFile is not a recommended way to open a label. Try to use openLabelXml() as I used in a original sample for you. Also, openLabelFile will not work if the browser is running on a mobile device, like iPad or Android.
I apologize, Vladimir. Please delete my previous comments. The blog kept filtering it out even when I tried to use the appropriate tags.
I’m attempting to build a label by hand with XML. It’s working nearly perfectly, except the client reports that the text prints small. I want it print in 18pt size. Am I doing something wrong? Here is my XML: http://snipt.org/xwv
try to set TextFitMode to “AlwaysFit”
what is the text you are trying to print?
I will try that, thanks. I’m trying to print fake generated names and addresses, like:
John B. Doe
894 Randall Drive
Honolulu, HI 96819
Hey Vladimir, after making the AlwaysFit change, it still prints small. I estimate the printed text to be around 12pt, instead of 18pt.
Here is the Javascript I’m using: http://snipt.org/xxgn
Here is the HTML: http://snipt.org/xxgo
Everything about it works perfectly except the font size. I wonder if it’s something silly, like do I have the font code in the wrong line?
seems like there is a empty line in the textarea element. So, you are trying to print four lines, not three one. That is why the text is shrinked.
Try to remove it, e.g. replace
Honolulu, HI 96819
</textarea>
to
Honolulu, HI 96819</textarea>
Wow, I was surprised that made a difference, but it did. It works now. Thanks Vladimir. I’m grateful!
hello, i’m trying to use the framework behind an authenticated proxy but, on loading the jsp page that use the framework code, i receive error 407 under internet explorer and error calling method on npobject under firefox. the sample page in dym site works well, but i’m just doing the same things! any ideas? thanks a lot!
Could you provide more information about your setup? What functions are called by your code, what are the DYMO samples that work for your setup? maybe a snippet of your code that does not work?
Thanks,
Vladimir
Well, i’m doing some tests, my label has an image and the source is taken from an url pointing to the chart goggle api’s. I need the, to generate a QRCode image. Could be the reference to an external image that is denied from proxy? Searching the forum i discovered the experimental QRCode image, that works well, only i need to adjust the size of the QRCcode, that is too small for the label, i tried the othe sizes bute they have no effects. Are there other parameters that I could use ?
Hey Vlad, don’t let me alone!!! ;-)
In the post, it mentions “The easiest way to obtain the xml is to design the label using DYMO Label software, saving it into a file, then pasting file content into the js code”.
How do you do this?
I opened my label in the DYMO Label Software 8.0 but there is no Save to XML function. Opening the label file yields a bunch of gibberish.
In DYMO Label software you design your label and then just save it, as .label file, say ‘MyLabel.label’ .label file is xml. Put the MyLabel.label alongside of your html pages on the server. Then load it like this
var label = null;
$.get(‘MyLabel.label’, function(labelXml)
{
label = dymo.label.framework.openLabelXml(labelXml);
}, ‘text’);
For a complete example, see http://developers.dymo.com/2010/06/17/dymo-label-framework-javascript-library-print-multiple-labels/
I work at a Physical Therapy clinic and I use the LabelWriter 400 all the time for printing address’ for statements. Here lately my “address fixer” is not working. It is telling me that there is no internet connection. I am able to get on the internet and look at other sites with no problems though. Anyone have any ideas?
Please contact tech support at http://sites.dymo.com/Support/Pages/ContactForm.aspx
Bottom part of the retour adress is too small. I Have the label above then a line and then an image with my own adress
My own adress is on one line. I think the problem is how to set a break
Here my example
var labelXml = ‘
Landscape
Shipping
30323 Shipping
Retouradres
Rotation0
False
False
CenterBlock
Top
AlwaysFit
True
False
AFZ. CFpianoservice De oude munt 113 3824 DJ Amersfoort
Then this is the issue AFZ. CFpianoservice De oude munt 113 3824 DJ Amersfoort
Should be
AFZ. CFpianoservice
De oude munt 113
3824 DJ Amersfoort
Thanks for looking in
Already found it :-)
Use n for a linebreak
Yes, but the easier way is to use label.setObjectText call instead of manipulating XML directly.
Hi,
We have implemented the concept provided above and its working fine.Thanks for the detailed explanation provided.
We have one small issue like the print that is coming out on the label is of Font Family “Arial”,Size is “10” and it is bold.Customer doesn’t want the text to be in bold font.How to control it so that we will not get the text printed on the label with bold font.
Here is the JavaScript code written
var driverlabelXml = ‘
Portrait
Small30334
30334 2-1/4 in x 1-1/4 in
Text
Rotation0
False
True
Center
Middle
ShrinkToFit
True
False
//
// Driver Name
//
//
//
//
//
‘;
Please see the following post: http://developers.dymo.com/2011/10/04/dymo-label-framework-javascript-library-advanced-text-formatting/
I am having a problem getting the actual label to print. I am able to print to the printer using the sample. However, when I put the code into my application I get the printer, label to load and the text assigned to the label, BUT the label.print(printerName) does not print. Any ideas?
function printbarcode(id) {
alert(‘test ‘ + barcode.elements[“id”].value);
// select the first Dymo printer
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0) {
alert(“No DYMO printers are installed. Install DYMO printers.”);
}
var printerName = “”;
for (var i = 0; i < printers.length; ++i)
{
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}
alert("Printer " + printerName);
// Get label to print
$.get("Barcode.label", function(labelXml)
{
label = dymo.label.framework.openLabelXml(labelXml);
// Set the label text to print
label.setObjectText("Barcode", barcode.elements["id"].value);
// alert("label " + label);
}, "Text");
alert('END 11' );
// Print the label
label.print(printerName);
}
It is resolved. I had to specify the location before “barcode.label” i.e. $.get(“http://www.xxx.com/Barcode.label”, function(labelXml)
{
What would cause the $.get not to execute? I am now getting “label is not defined” as a popup. It worked for awhile then stopped…….
I am trying to print a 30856 name badge label on the DYMO Labelwriter 400 using the code in this tutorial but it seems like the printer thinks it is printing to an address label… how can I adjust the size of the paper so the printer knows to print on a name badge? Thanks!
You can specifiy the label size in your label template (*.label file). Either use DYMO Label Software (DLS) to create your label template or check the following blog posts which are talking about the Label File Format. http://dymodevelopers.wordpress.com/tag/xml/
When I attempt to use the tag with 30857, I receive an exception. I’ve only seen examples using “30252 Address” and “30256 Shipping”. I tried “30857 Name” and “30857 Name Badge” and both throw an exception. Any thoughts?
You’ll find the form names in the Windows Print Management (Administrative Tools -> Print Management -> Forms). Please try “30857 Badge Label”.
Thanks, that solved the problem. Just for my own edification, is that documented somewhere in the API?
And one other question. Is there a method in the Javascript API to get the dimensions of the selected label?
[…] JavaScript API […]
Does not work in Chrome in 2013
I assume you are referring to Chrome on Mac OS X. Now, Chrome version 22 and above have dropped support for Carbon event model of NPAPI plugins. This model event is default for 32-bit plugins and that’s why it can’t load the DYMO plugin. We have to write a new plugin which is anticipated for DLS 8.5.0.
I’m using DYMO LabelWriter 310, in MAC . Safari Version 6.0.1 (8536.26.14).
Here is the sample code which is as shone above but still “”” I’m not getting the label.print (printerName)”” functionality .
I’m able to get the printers and their name but ..?
Here is the code which I have been tried So far,
function labelprint()
{
var label = DYMO.Label.Framework.Label.Open(“squareBrc.label”);
alert(“Before Text”);
label.SetObjectText(“NameTxt”, “Ample”);
alert(“After Text”);
label.SetObjectText(“CompanyTxt”, “Ample Tech”);
label.Print(“DYMO LabelWriter 310”);
}
//2nd Way
function PrintLabel1()
{
//window.print();
var labelXml = ‘
Landscape
Address
30252 Address
Text
Rotation0
False
True
Left
Middle
ShrinkToFit
True
False
‘;
var label = dymo.label.framework.openLabelXml(labelXml);
alert(” “+labelxml);
var printers = dymo.label.framework.getPrinters();
var printer=printers[0];
printerName = printer.name;
alert(“”+printerName);
label.setObjectText(“Text”, textTextArea.value);
// dymo.label.framework.printLabel(printerName, 1, label, label);
label.print(printerName);
}
Please forward your question to DYMO according to the SDK Troubleshooting Tips post which can be found here http://developers.dymo.com/2011/10/12/sdk-troubleshooting-tips/
Chrome Mac support please.
I assume you are referring to Chrome version 22 and above. They have dropped support for Carbon event model of NPAPI plugins. This model event is default for 32-bit plugins and that’s why it can’t load the DYMO plugin. The new plugin comes with DLS 8.5.0 which can be found here http://download.dymo.com/software/mac/DLS8Setup.8.5.0.dmg
Thanks for your reply pi. I have both Dymo Label Version 8.5.0.1836 and Chrome v26.0.1410.43 installed. The example here : http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html shows the message “No DYMO printers are installed. Install DYMO printers.”. Am i missing something obvious ?
How about multiple DYMO printers? I have a DYMO 450 for barcode label printing and a standard POS58 receipt printer. Was not aware the DYMO 450 can print receipts too, so can you install 2 on the same PC and if so, can you change the name it installs under so they can be called separately?
Yes, you can install multiple DYMO printers. The names can be change in the Windows “Devices and Printers” window. DYMO is also selling the LabelWriter 450 Twin Turbo which is allowing to print on 2 roles all the time.
Hi, are there plans to implement iOS AirPrinters? Seems these examples do not recognize them?
thanks!
Chad
Is there a requirement to also have the .label file on the local machine?
Prerequisites state that only the DYMO label software be installed on the machine.
I was able to print labels from my web app on the machine that I used to generate the label just fine.
It wasn’t until I also placed the .label file on the other test machines that I was able to get it to print correctly.
Hi Chris,
Any label files loaded by your application will need to be on the client machine.
Hello,
I developed some software for a client using this framework but he reported me today, it’s no longer working. I’ve tested it myself and indeed it’s broken. I believe the reason is an update to the website. For example: http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js this doesn’t load any javascript, but it loads a language selector instead…, this is the exact error I get:
SyntaxError: Unexpected token '<' in ContrySelectorView:1
I hope this issue will be sorted out soon. Thanks in advance.
John,
Labelwriter.com is currently down. We are working to resolve this issue. We will update the latest blog post when the site is back up and running.
I am currently unable to download the latest javascript file; that URL is redirecting to the dymo home page. Where can I find a copy of the JS to host on my servers? I have an urgent client need to fix it :/
Labelwriter.com is currently down. We are working to resolve this issue. We will update the latest blog post when the site is back up and running.
Dear All, May I ask some questions?
Can Dymo printer installed under Untuntu system,
Can Dymo support Non-English character ,I will use Chinese to print my label (support under Javascript ? )
Which Dymo label printer support javascript to print?
Thank you all
DYMO does provide a SDK for Linux. Please check the following blog post for more information:
http://developers.dymo.com/2012/02/21/announcing-dymo-labelwriterlabelmanager-sdk-1-4-0-for-linux/
Basically the DYMO printers are printing images. Therefore you should be able to print whatever you want since a image is being passed to the driver and the driver will convert the image to the appropriate print commands. The JavaScript Library isn’t support on Linux though.
Basically all LabelWriter 4xx series printers are supported by the JavaScript Library.
I inherited an old system that uses a .lwl file – which looks to be a binary representation of the badge template. Does Dymo offer a conversion utility to turn that template into XML so I can use it with the java script?
Jamie,
You can simply open this file in DLS and resave it. It will be saved into the new format.
thanks for this library. Still going strong in 2014, in Firefox.
it’s just too bad there isn’t an https server hosting it.
You can host your copy on your own https server.
May I ask some questions?
If there are any java instance to invoke LabelWriter 450 ,not use javascript?
I am not a Java expert, but you might be able to invoke JavaScript from Java.
DYMO is providing APIs for .Net, COM and JavaScript. I guess you could implement a JNI and call the C++ interface from Java. Of course that code wouldn’t be platform independent!
Hi , I have a question here.How can I input image into labelXml? I appreciate.
The best approach to your problem is to use DLS to design the label that you want to use. When you save the label file, it will contain the label xml that you want to include in your labelXml variable.
in VisitorManagement example, wherein you can choose template and photos you want to use on the label. Is it possible to setup the printing to be continuous? Because I created a small label and theres no problem with it but it is consuming a long strip. Maybe continuous mode will fix my problem. Is it possible to set it to continuous printing in that example? Thanks
Heres the link im talking about:
http://labelwriter.com/software/dls/sdk/samples/js/VisitorManagement/VisitorManagement.html
Chris,
I’m not sure exactly what you are asking, but the Visitor Management example is an example for printing a die-cut name badge label to a LabelWriter printer. This example should not be used to print to a continuous tape printer.
Hi
I have made changes to the Dymo Web print but am having some issues.
First issue is when I type into the textarea the text is top left to start with and this is fine. But once I print to a label the text has moved down about 2 rows
Second issue is there any way in making the printed text fill the whole Label or at least increase the text size
Html
W1MonPrint
DYMO Label Framework JavaScript Library Samples: Print Label test 2
Label 1 text:
Print
Label 2 text:
Print
Label 3 text:
Print
Print All
Dymo Java Script Edit
function printStuff(what)
{
try
{
// open label
var labelXml = '\
\
Landscape\
Address\
30252 Address\
\
\
\
Text\
\
\
\
Rotation0\
False\
True\
Left\
Middle\
ShrinkToFit\
True\
False\
\
\
\
\
';
var label = dymo.label.framework.openLabelXml(labelXml);
// set label text
label.setObjectText("Text", what);
// select printer to print on
// for simplicity sake just use the first LabelWriter printer
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0)
throw "No DYMO printers are installed. Install DYMO printers.";
var printerName = "";
for (var i = 0; i < printers.length; ++i)
{
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}
if (printerName == "")
throw "No LabelWriter printers found. Install LabelWriter printer";
// finally print the label
label.print(printerName);
}
catch(e)
{
alert(e.message || e);
}
}
function print1()
{
var textTextArea = document.getElementById('1textTextArea');
printStuff(textTextArea.value);
}
function print2()
{
var textTextArea = document.getElementById('2textTextArea');
printStuff(textTextArea.value);
}
function print3()
{
var textTextArea = document.getElementById('3textTextArea');
printStuff(textTextArea.value);
}
Hi Patrick,
I suggest that you design your label template with DYMO Label Software (DLS), make sure it prints as desired and save it as a template. Then you load the template in your code and just set the object text.
Thanks dymodev
I thought i did that all ready. i must have worked on an old script. as soon as i made the new layout template with the DYMO software my script worked thanks.
just one question how do i put code onto this website is it code inside on both ends of my code or some other way
thanks
I am using Polymer for my website and when I try to include the webcomponents.js file (polymer file) with the dymo framework file my dymo code will not work. Returns that there are no Dymo printers installed. If I comment out the webcomponents.js file everything works fine.
Any reason why the dymo framework script will not function with other javascript files?
Hi Tyler, we do not have any experience with Web Components. Have you checked to see if it interferes with any other JavaScript library? There could be known issues with it.
Latest Dymo software will not run after installation.
“FATAL ERROR: Absolute Path Required”
Hi Bill,
I’m sorry that you are having issues with launch the software. This blog is for helping developers use the SDK that is provided for the printers. If you would please contact: DYMO Customer service at 1 (877) 289-3966, one of our representatives can better assist you in solving your current problem with the DLS Software.
Thank You.
I am trying to print labels from a web page. This works fine on one PC, but not on another – I get the error
printLabel(): labelXml parameter should be specified
Both PCs are using IE11 (I’d try it in Chrome, but it appears not to recognise the namespace at all). The code is below – do you have any suggestions?
function checkStockCode()
{
// probably not relevant to my question here.
}
function printLabel()
{
var i, l, o, s;
try
{
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0)
throw "No DYMO printers are installed.";
var printerName = "";
for (i = 0; i < printers.length; ++i)
{
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}
if (printerName == "")
throw "No LabelWriter printers found.";
l = dymo.label.framework.openLabelFile("file://our_servername/productlabel.label");
o = document.getElementById("StockCode");
s = o.value;
l.setObjectText("TEXT_STOCKCODE", s);
o = document.getElementById("Description");
s = o.value;
l.setObjectText("TEXT_DESCRIPTION", s);
o = document.getElementById("Serial");
s = o.value;
// Barcode doesn't usually like lowercase.
s = s.toUpperCase();
l.setObjectText("TEXT_SERIALNUMBER", s);
l.print(printerName);
}
catch(e)
{
alert(e.message || e);
}
}
Stock Code:
FIND
Description:
Serial:
PRINT
Is DYMO Label Software installed on the machine that is not working?
When I try to load the label from the file as below I get an error: “Error calling method on NPObject.”
label = dymo.label.framework.openLabelFile(“Rx.label”);
Loading from a variable labelXml with the same label definition is working fine:
label = dymo.label.framework.openLabelXml(labelXml);
I am not able to figure out what is wrong? Any help in fixing the issue will be very much appreciated.
Thanks!
What browser are you using?
Did this ever get sorted ? i’. running into the same error and the browser i use is Chrome..
If you are using Chrome or Opera, it is most likely due to the phasing out of NPAPI from their browsers. Please reference this post:
http://developers.dymo.com/2014/12/04/dymo-label-framework-and-chrome/
How .lwl file load with the help of javascript?
I try using .label file but when i upload .label file its not able to pick the .label file & getting error of path.
please reply asap..
.
.lwl is the old label file extension. .label files should be used. If you open a .lwl file in DLS it will be automatically converted to .label format.
As for the .label file not being found, sounds like an issue with your server.
how i create label by my own using this API & it returned as XML file as .label file
so i immediate change font or another content and i get an XML
please help ,
this will reduce my lots of work.
create & modify label without DLS .
in javascript Or another technology.
Creating a label from scratch if not really an option at the moment. Typically, SDK users will create a label in DLS and then allow their users to modify data on the label using the SDK.
Just updated to Os X 10.10.3 in the middle of the night, and suddenly noticed that label printing is not working any more. I can print with DLS but not with this js API.
The labelwriter.com is currently down. Please see http://developers.dymo.com/2015/04/16/labelwriter-com-outage-3/ for more information.
Thanks a lot, pl! That saved my week :)
I didn’t even remember, that our application was using external script.
Hi guys
what is the situation?
is the labelwriter.com up and raunning or what?
I my programs sill do not work it keeps showing the error No Dymo printers are installed
LabelWriter.com is up and running. Please check the following post in case you are running Chrome 42:
http://developers.dymo.com/2014/12/04/dymo-label-framework-and-chrome/
Hi All
I just found out that google chrome is blocking the SDK from running
and I get No Dymo Printers available java prompt.
on IE the program works fine.
I tried instructions here http://developers.dymo.com/category/dymo-label-framework/
but did not work.
any suggestions?
With version 42 of Chrome, Google now disables NPAPI which is required to run our plugin. However, you can manually enable it by typing the following into the Chrome address bar and adjusting the setting:
chrome://flags/#enable-npapi
Check the following blog post for more detailed information:
http://developers.dymo.com/2014/12/04/dymo-label-framework-and-chrome/
Hello, Chrome 45 (expected to be released May 29th, 2015) will drop support for NPAPI altogether. Any thoughts on a work-around? Is Dymo working on support for a newer standard (PPAPI perhaps) or other option?
According to the NPAPI depreciation that Google has posted:
https://www.chromium.org/developers/npapi-deprecation
Chrome version 45 is set to be released in September. We are working on a solution with that time frame in mind.
Here is an article on our blog that talks about the issue with relevant comments beneath it.
http://developers.dymo.com/2014/12/04/dymo-label-framework-and-chrome/
Hello, thank you for this useful template. I try to read the text to print out of a *.txt file and want to print the read data into a table (or even better an image.bmp). Any suggestions on this?
read data from txt file -> fit read data into a table (got a label template made by dymo software) -> print table and data
labelwriter450
Johannes,
Our SDK does not have a “table” object type. You’ll need to, as you mentioned, take an alternate approach.
Thank you drobdymo,
is it possible to make this table as an image? lets say *.bmp and print the data into this image?
Our SDK allows to embed and print an image object, but doesn’t support the generation of an image.
Cant seem to wrap my head around what I am doing wrong..
I have a asp.net c# web form.
Created a label using the dymo label maker software.
saved the label to a local folder.
If I access it from running in debug mode (localhost) all works fine, as soon as I put it on our test server, it cant find the CoreLabelsm.label.
I even tried putting it on the server in the project directory and change the file part to point to the server path to the file.
Can someone point me in the write direction to get it to see the label
var label = DYMO.Label.Framework.Label.Open(“c:\\repair\\docs\\CoreLabelsm.label”);
LabelWriterPrintParams p = new LabelWriterPrintParams();
p.RollSelection = RollSelection.Auto;
label.SetObjectText(“Text”, “test”);
label.Print(“DymoLabelParts”, p);
Thanks for any help or suggestions.
Gary
I assume that your problem is caused by a permission issue. Please make sure that you have the rights to open the label file.
It opens fine when I run on my local host, just not when I put it on the development server.
So I assume I would have permission..
thanks
Gary
A couple quick questions..
Should the .label file be stored on my local pc or the server ?
Do I need to have the SDK installed on the server, or just my development PC?
Thanks
Gary
There are different scenarios possible. Please refer to the following blog post: http://developers.dymo.com/tag/deployment/
i´m getting the following error
ExceptionType: “DYMO.DLS.Runtime.DlsRuntimeException”
Message: “Unable to load label template”
StackTrace: ” at DYMO.DLS.Runtime.Label.Load(String uri)
↵ at DYMO.Label.Framework.Label.Open(String uri)
i´m using
string uri = HttpContext.Current.Server.MapPath(@”~/TempF/PlantillaQR.label”);
var label = DYMO.Label.Framework.Label.Open(uri);
label.SetObjectText(“txtReferencia”, “”);
label.SetObjectText(“Barcode”, obj[i].Tr_Barcode);
label.Print(“\\\\mam05jsc\\DYMO LabelWriter 400”);
i check, the label is in the path, and the application has all the permissions
what can it be?
thanks for your help
Does it work when loading the the .label file form local drive? Make sure that the returned uri string isn’t a null reference.
Hi ,
I have a really frustrating problem with numerous DYMO labellers that prints out a blank label in between each good one. I’m using the latest driver’s v8.5.1. I’m trying to print from a third party vendor application written in C#, with a windows OS platform ( This problems exists in XP and 8.1). The application works fine when connected as the default printer, but the problem seems to originate when the dymo printer is not connected as the default printer and a network printer is the default printer. Is there something I can do code wise in the DLS or a simple fix.
Hi Dan, This could be caused by a number of issues:
1. The paper size for the label that is being sent to the printer is larger than the paper in the printer.
2. The printer could need to be cleaned, something could be blocking some of the internal sensors.
3. Some third party manufactured labels could cause this issue.
4. There could be an issue with the third party vendor application. You could try one of the samples contained within our SDK Samples and documentation and if the sample works then you will need to contact a representative from the vendor that provided the application.
For some reason, the printer is not being detected. I’ve tried different browsers.
This is the code –
function loadText() {
var labelXml = ‘LandscapeAddress30252 AddressTextRotation0FalseTrueLeftMiddleShrinkToFitTrueFalse’;
var label = dymo.label.framework.openLabelXml(labelXml);
var labelSet = new dymo.label.framework.LabelSetBuilder();
var record = labelSet.addRecord();
var textMarkup = ‘$text$’;
record.setTextMarkup(‘Text’, textMarkup);
var env = dymo.label.framework.checkEnvironment();
var printers = dymo.label.framework.getPrinters();
var printerName = “”;
if (printers.length != 0) {
for (var i = 0; i < printers.length; ++i) {
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter") {
printerName = printer.name;
break;
}
}
}
label.print(printerName, null, labelSet.toString());
}
function frameworkInitShim() {
dymo.label.framework.init(loadText); //init, then invoke a callback
}
Hi Jim,
What version of DLS do you have installed on the client machine? What OS is the client machine? Can you print a label from DLS on the client machine?
Hi Jim,
did you solve your issue? I have the same problem!
On this line:
var printers = dymo.label.framework.getPrinters();
I got “null” are return value :(
Regards,
Marco
Can you show an example of connecting to the print server when it’s on a different subnet?
Moses,
Are you trying to connect from an SDK application or just through DYMO Label Software? If you are using DLS, you will need to contact DYMO Support as they can best help you in this case. Nonetheless, the user guide for our print server may be a good starting point for you. Links to support and the user guide can be found below.
http://www.dymo.com/en-US/online-support/online-support-contact-us
http://var.dymo.com/us/files/2011/12/LabelWriter-PrintServer-UG_en-UK.pdf?9d7bd4
Hello! Great post!
From some days this line of code does not return the printer:
// select printer to print on
// for simplicity sake just use the first LabelWriter printer
var printers = dymo.label.framework.getPrinters();
Could you help me?
Regards,
Marco
I assume that you are using “DymoLabelFramework”, Try this sample code.
// clear all items first
LabelWriterCmb.Items.Clear();
foreach (IPrinter printer in Framework.GetPrinters())
LabelWriterCmb.Items.Add(printer.Name);
if (LabelWriterCmb.Items.Count > 0)
LabelWriterCmb.SelectedIndex = 0;
LabelWriterCmb.Enabled = LabelWriterCmb.Items.Count > 0
I’m using “DYMO.Label.Framework.latest.js” on Chrome
The solution also not works for me.
-> If you take the Firefox, then you will be asked for calling the Funktion. –> Firefox works
-> Chrome ist not working.
Hi Michael, due to changes within Chrome you will need to use an update for the SDK:
Web Service Beta 1 contains useful information
Web Service Beta 2 is the latest package
Can we use this library for star printer as well ?
No, the DYMO Label Framework JavaScript Library supports DYMO printers only.
Hi am wonder if this is sdk error am run them across network as shared printer from 64 bit via 32 bit machine I get logs for dymo plug
DateTime=2016-01-12T21:16:57.2692429Z
Act!.exe Error: 0 : DYMO.DLS.Runtime.DlsRuntimeException: Printing Error: PrintTicket provider failed to convert DEVMODE to PrintTicket. Win32 error: -2147467259 —> System.Printing.PrintQueueException: PrintTicket provider failed to convert DEVMODE to PrintTicket. Win32 error: -2147467259
at MS.Internal.Printing.Configuration.PTProvider.ConvertDevModeToPrintTicket(Byte[] devMode, PrintTicketScope scope)
at System.Printing.Interop.PrintTicketConverter.InternalConvertDevModeToPrintTicket(PTProviderBase provider, Byte[] devMode, PrintTicketScope scope)
at System.Printing.PrintTicketManager.ConvertDevModeToPrintTicket(Byte[] devMode)
Could you elaborate a little bit more on your issue? What DYMO Label Software (DLS) version are you using? Where is the printer attach (client/server)? How are you sharing the printer? How does the client access the printer? Are you able to print from DLS from the server and client? Are you using your own application for printing? Are you using the the DYMO Label Framework?
Hi, I’m completely new to this and got my first Dymo printer yesterday. It’s a LabelWriter 450 and I have installed it with the latest version of DLS for Windows 8.5.3 (I’m running Windows 8 btw). I downloaded and tried this example locally but with the 2.0.2 version of the javascript framework (downloaded locally as well).
It works in both Chrome and Firefox but it is extremely slow. It takes up to a minute to get the label printed. Looking at the network tab in Chrome developer tools it seems like GetPrinters is the main problem. In my last attempt to print it had a Waiting (TTFB) of 53.04s so it seems like it’s the web service that is slow.
What can I do to speed this up? Printing from the actual Dymo Label application is lightning fast.
Some additional findings. I simplified things to just this:
function PrintLabel()
{
var label = dymo.label.framework.openLabelFile("D:\\temp\\dymo\\Badge.label");
label.setObjectText("txtName", "John Smith");
label.setObjectText("qrData", "55224499");
label.print("DYMO LabelWriter 450");
label.print("DYMO LabelWriter 450");
}
Apparently label.print also calls Get Printers and the interesting thing I find is that with two label.print after each other the first one is still slow but the second one is fast resulting in a waiting time of usually 53 seconds and then both tickets are printed. The second GetPrinters call only takes a few milliseconds. If I trigger the function again it’s the same, first call slow, second one fast.
The web service attempts to bind to a port within a range of 10 ports starting with “41951”. I am wondering if you are using the the last one of the 10 ports which the web service attempts to bind.
The port can be configured. Could you please use “configure” to see what port that it is bound to. You might try to use a different port and check if it has an impact on the delay.
Thanks for your reply. I checked, and it uses the first port 41951.
I tried downgrading to 8.5.1 and the beta2 of the web service and js with no difference. I also tried uninstalling and reinstalling the whole thing, still the same. BUT when I installed it on an older Windows 7 machine it worked perfectly. But I still want to know what is happening and fix it so I can use my regular computer and be sure it doesn’t happen when I install it on other computers later.
Are there any logfiles saved anywhere that can help troubleshooting?
There seems to be a problem with web service discovery, and once it is discovered, everything runs smoothly.
If it runs slowly in both browsers, this is most likely system-wide problem, for example some software (like antivirus or firewall) interferes with service work. Please disable antivirus and/or firewall and see if it helps.
Could you please provide the following information:
1. OS version, 64- or 32bits
2. Firefox and Chrome version
3. Third-party software with versions that may interfere (system-related, like antivirus, and network-related, like firewall).
4. Web service log: %LocalAppData%\DYMO\DLS8\DLSWebService.log (it is recommended to delete existing log before making a test run, so it will contain only relevant recent messages)
5. Enable web service tracing (by setting dymo.label.framework.trace = true; before calling dymo.label.framework.init()) and provide browser’s console output.
6. Open developer tools in browser(usually by pressing F12), go to network section and run the tests with network window open, then make a screenshot to analyze network activity.
I tried disabling the firewall, antivirus is managed on a domainlevel so I can’t disable that, but on the other hand the other computer where it is working is connected to the same domain and has the same antivirus. Also I’m not sure it has to do with web service discovery because StatusConnected runs fine in a few ms and then it hangs on GetPrinters almost always for 53.0X seconds.
1. Windows 8 64 bit
2. Chrome 47.0.2526.111, Firefox 43.0.4, Internet Explorer 10.0.9200.17607
3. Windows Firewall and System Center Endpoint Protection
4. This is the output I get from the code above. Please note the 53s gap between the first GetPrinters and the first PrintLabel and compare it to the gap between the second GetPrinters and the second PrintLabel:
DYMO.DLS.Printing.Host.exe Information: 0 : CheckServiceStatus
DateTime=2016-01-20T08:42:51.1857778Z
DYMO.DLS.Printing.Host.exe Information: 0 : OpenLabelFile: D:\temp\dymo\Badge.label
DateTime=2016-01-20T08:42:51.1977863Z
DYMO.DLS.Printing.Host.exe Information: 0 : GetPrinters
DateTime=2016-01-20T08:42:51.2137966Z
DYMO.DLS.Printing.Host.exe Information: 0 : PrintLabel: DYMO LabelWriter 450
DateTime=2016-01-20T08:43:44.2499132Z
DYMO.DLS.Printing.Host.exe Information: 0 : Utils.CreateLabelPrintParams(): printParams == null, creating default printParams based on printer type
DateTime=2016-01-20T08:43:44.2609209Z
TapePrintTicket.FixLabelLength(): Unable to retrive MediaSizeWidth or MediaSizeHeight from print capabilities xml
TapePrintTicket.FixLabelLength(): Unable to retrive MediaSizeWidth or MediaSizeHeight from print capabilities xml
DYMO.DLS.Printing.Host.exe Information: 0 : GetPrinters
DateTime=2016-01-20T08:43:44.6882120Z
DYMO.DLS.Printing.Host.exe Information: 0 : PrintLabel: DYMO LabelWriter 450
DateTime=2016-01-20T08:43:44.7012203Z
DYMO.DLS.Printing.Host.exe Information: 0 : Utils.CreateLabelPrintParams(): printParams == null, creating default printParams based on printer type
DateTime=2016-01-20T08:43:44.7152296Z
TapePrintTicket.FixLabelLength(): Unable to retrive MediaSizeWidth or MediaSizeHeight from print capabilities xml
TapePrintTicket.FixLabelLength(): Unable to retrive MediaSizeWidth or MediaSizeHeight from print capabilities xml
5. This is the output I get. Everything except the last three lines appear almost instantly and the last three appear at the same time as the labels are printed.
checkEnvironment > cachedWebPort : 41951
checkEnvironment > trying synchronous service discovery
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
checkEnvironment > web service found at port :41951
onEnvironmentChecked > checkResult isBrowserSupported : true, isFrameworkInstalled: true, isWebServicePresent: true, errorDetails:
chooseEnvironment > WebServicePresent
_createFramework > return _framework : [object Object] (sync)
_createFramework > returning existing instance of _framework, has callBack: false
_createFramework > returning existing instance of _framework, has callBack: false
_createFramework > returning existing instance of _framework, has callBack: false
_createFramework > returning existing instance of _framework, has callBack: false
6. Everything looks fine there except for the first GetPrinters call that has the following timing details:
Connection Setup
Queueing: 0.43ms
Stalled: 1.37ms
Request/Response
Request sent: 0.16ms
Waiting (TTFB): 53.04s
Content Download: 0.55ms
Hi Niklas,
This is the first that we’ve heard of such a delay. If understand correctly, you have only have one machine that exhibits this issue? It strikes me as a machine related issue but I will forward this to the developers and see if they have any ideas.
I also ran into the same issue “Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check http://xhr.spec.whatwg.org/.” when setting up my printer to print on demand from my HTML page. What I ended up having to do is separate the load printer and print to printer functions instead of loading the printer in the same function that prints…
var printerName = "";
function load_dymo(){
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0) throw "No DYMO printers are connected. Install and connect a DYMO printer.";
for (var i = 0; i 0){
var l = dymo.label.framework.openLabelFile("/dymo_layouts/barcode.label");
l.setObjectText("BARCODE", barcode);
l.setObjectText("TEXT", description);
l.print(printerName);
} else {
alert("Unable to Print Barcode!\nPlease connect DYMO printer first.");
}
}
————————–
In my header file :
————————–
$(window).load(function() {
load_dymo();
});
Hope that helps!
Hi! I am using this API for printing labels and it works great!
My question though is, how can I export the generated labels to PDF?…
Edward,
Our SDK does not support printing to PDF. If you are using our Framework, you can render a label as a PNG which you could then convert to a PDF.
http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkdotNETHelp/html/M_DYMO_Label_Framework_ILabel_RenderAsPng.htm
I’m having an issue with vertical aligning label text for a twin turbo roll printing on the right side. My XML works fine when I print on the left, but if I print from the right the text is aligned to the very bottom instead of in the middle. Any idea what’s going wrong here?
var text = "Testing";
var labelXml = 'LandscapeAddress30252 AddressTextRotation0FalseTrueCenterMiddleAlwaysFitTrueFalse'+text+'';
var label = dymo.label.framework.openLabelXml(labelXml);
label.setObjectText("Text", text);
var params = dymo.label.framework.createLabelWriterPrintParamsXml({twinTurboRoll: dymo.label.framework.TwinTurboRoll.Right});
label.print(printerName, params);
Have you loaded 30252 address labels on both sides of your Twin Turbo printer? Does it print correctly when loading your .label file in DYMO Label Software (DLS) and print to the left as well right? Are you able to duplicate with the DYMO Label Framework C# Sample which is shipping with the DYMO SDK?
Im facing a similar issue on Label Writer 450 Twin Turbo. I have the print params configured to the Right side, however while initiating the print it prints on the both side. While doing the same on the Left side, it just works as expected (Only on the left side).
var printParams = {};
printParams.copies = 1;
printParams.TwinTurboRoll = ‘Right’;
printParams.printQuality = ‘Text’;
printParams.jobTitle = ‘Large Label’;
Any thoughts on how to fix the issue.
Hi Karthik,
We have seen this problem in the past. So far, we have been unable to resolve it. Please feel free to provide more details about your code, environment, etc. in order to better help us troubleshoot this issue.
Thanks,
Jeff
I have a text label that needs to be printed spanning three lines
var printThis = “000000 STRING VALUE\n
STRING VALUE\n
(IN) STRING, STRING (STRING)”
var label = dymo.label.framework.openLabelXml(labelXml);
label.setObjectText(“Address”, printThis);
label.print(“DYMO LabelWriter 450”);
i have searched and searched and searched online trying to figure out how to break a string into separate lines and i absolutely cant find anything. I also unminified the code and couldnt make heads or tails either.
how would i go about printing a long string on multiple lines? below is my labels xml
var labelXml = ‘\
\
Landscape\
Address\
30252 Address\
\
\
\
\
\
Address\
\
\
\
Rotation0\
False\
True\
Left\
Middle\
ShrinkToFit\
True\
False\
\
\
\
\
\
\
\
\
\
\
False\
Suppress\
\
\
\
\
\
\
\
\
‘;
What results are you seeing when running the code you mentioned?
Using the newest of everything but keep getting the error, that’s already mentioned here:
https://localhost:41951/DYMO/DLS/Printing/PrintLabel 400
when visiting that url, I see the webservice running but the page itself says: “Method not allowed”
Any suggestions?
http://developers.dymo.com/2010/06/02/dymo-label-framework-javascript-library-samples-print-a-label/
I am trying to integrate this application into our application. I have gotten it to work. Then I wanted to add bar code the label. Now it only prints the barcode.
I need it to print both the text and the bar code.
This is what I changed in the printlabel.js file
var barCode = document.getElementById('barCode');
\
Landscape\
Address\
30252 Address\
\
\
\
Text\
\
\
\
Rotation0\
False\
True\
Left\
Middle\
ShrinkToFit\
True\
False\
\
\
\
\
\
\
Barcode\
\
\
BarcodeText\
Rotation0\
False\
True\
barCode\
Code128Auto\
Medium\
Bottom\
\
\
None\
0\
Center\
\
\
\
\
';
label.setObjectText('Barcode', barCode.value);
Now I don’t get the text just the bar code. How to do I get both?
Thanks!
If you print your label file through DLS (DYMO Label Software) do you see the same result?
Is there an answer yet for printing from iPad to LabelWriter (450 Turbo specifically, but if not any other possibilities)?
Our SDKs do not currently support printing from mobile devices. We’ve had several customer’s create proxy services their mobile apps can talk to work around this implementation, but our SDKs do not support mobile printing natively.
Hi, When I deploy the application on the server, it picks up the printers from the Server although I would like the printing to be done on the client’s machine. Can we achieve it ? Thanks.
Hi Muddassir,
Sorry for the delayed response but we were having technical difficulties with our blog the past several weeks.
Please take a look at this web page regarding deployment and see if it helps:
http://developers.dymo.com/2010/06/15/label-printing-and-web-deployment/
Regards,
Jeff
Hello,
Does the DYMO label framework als works well over the network in combination with the DYMO print server?
We are printing from web browser, locally everyting is working smooth, but we need to print from more than one clients.
Thanks in advance,
Jos
It should.
Hello Vladimir,
So I am a trainee software developer and I need to print a QR Code that is generated by me on the webpage. It should print directly to the DYMO LabelWriter 4XL printer, on a 4×6 label without the print popup, when I press the print button on my webpage. Can you help me on how to go about this? Thanks in advance!
Have you taken a look at the documentation included with our SDK?
Demon does at
http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html
not work.
GET http://www.labelwriter.com/software/dls/sdk/dymo.label.framework.js 404 (Not Found)
It looks like that file is missing. I will investigate that for you.
The sample has been updated. Please let me know if it works for you now.
Hi
I want to print from a webpage. But I want to print the same text over an over again.
So I don;t need the button
Is it possible to print from webpage without a button?
Looking forward to hear from you
I am not sure I understand your question.
You certainly don’t need to program a button to print a label, you can code it however you would like.
Ron
Hi
My problem is that I can’t adjust the script in a way it works without the printbutton. I spend a night on google. but I can’t find the way to do it. I want to print. each time my page loads.
can you please help me?
I have found the right changes in the document
how can I use the library in an angular project?
Hi Jose,
Our Javascript SDK should do the trick for you. Learn about it here:
http://developers.dymo.com/tag/javascript/
Ron
This looks amazing, haven’t really tried the library, but from the sample code, it looks pretty straight forward!!
btw, I agree with Mike’s post in the first response. JSON is so much easier to use than XML. Nowadays, XML can be replaced by JSON in almost anywhere.
Wondering if you guys are any closer to using JSON?
Hi Billy,
We are sticking with XML for now…
Ron
I’m researching the available options for adding label printing to a 450 Turbo from a PHP web application we’re building. We need to print single and bulk labels from a backend database. Can someone please point me to any web sdks – I’ve downloaded and installed DYMO-Label-v.8-SDK.dmg but that just appears to have some AppleScript examples which I don’t believe are helpful for printing from Safari (we’re all Mac based). Any documentation for any web SDKs would be great as well.
Thanks,
Steve
Hi Steve,
We offer a Javascript SDK that should do the trick for you… Here is a link to some of our articles:
http://developers.dymo.com/tag/javascript/
Ron
Hi everyone, I’ve developed my web application, on PHP (Server), AngujarJS (Client). So, my problem is: when i’m trying to print the data from a little section of HTML, and after send the data to the Client and finally to my server, but, when is happening that process is so SLOWLY, and I don’t know what could be?
Hi Johan,
Can you be specific as to what is going so slowly? Have you tried printing from some of our samples?
Ron
Hi
Instead of textarea – Textbox is it posible to use ?
I have googled and tryed some things. But nothing seams to work. can you please tell me how to do it?
i mean: is it posible to use input type=”radio”
I am happy to help you with any issue you are having with the SDK. Unfortunately, I am not a javascript expery. I would assume you could use a page_load event or something similar.
Ron
It seems to stopped working in Firefox around version 56.0.2
It doesn’t work on http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html nor at my website.
However it works in IE, so there is something with the browser.
Will there be a update that make it compatible with FF again?
We have a couple of reported issues that went away when upgrading to version 57 of Firefox. Perhaps you should try this.
Can you please post a link to the possible solution for these reported issues?
I’m sorry. I read your post to fast an poorly. I will try to update to FF 57.
I upgraded to FF 57, but the issue still remains, both on my website and at http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html
Do you have any other solution?
what version of dls do you have installed? is it the same version that is on the developer machine?
While upgrading to the latest version I noticed that Windows 10 didn’t load Dymo Label Web Service properly. Thanks for pointing me in the right direction. You’re prompt reply to my questions is highly appreciated
How would you go about having 2 print buttons on a single page, with each button printing to different labels? Have tried loads of things but can only ever get the first one to fire, the second button does nothing.
Hi William,
You should be able to use the buttons OnClick event handler to put the proper code in place.
Ron
How can i integrate Dymo printer with google sheet using app script or Microsoft Excel using vba ?
You can use our COM SDK when interfacing with Excel/VBA. I am not aware of any mechanism to integrate with Google sheets.
Ron
I am having issues with a delay of about 20 seconds from when I push the button, to when the label prints. This happens on all computers, all pages, including your example with no modifications here.
Here is the info you asked for on a previous similar question, is there a fix?
1. OS: Windows 7 Professional 64 bit
2. Chrome Version 66.0.3359.117 (Official Build) (64-bit)
3. McAfee Endpoint Security version 10.2
4. Web service log: log
5. Enable web service tracing: I don’t know how to do this, I’m running your demo, straight from your site, as-is.
6. Open developer tools in browser: see screenshot.
Hi Owen,
We have identified the issue and are currently working on a fix. We will be releasing the fix ASAP.
Until the actual fix goes out, users can alleviate this slowdown by preventing this call. We have seen success with two methods thus far.
1: Prevent connections to 128.30.52.100 (hans-moleman.w3.org).
2: Use the windows defender firewall to prevent DYMO.DLS.Printing.Host.exe from making outbound connections.
We apologize for the inconvenience, and will update this post as soon as the situation has been resolved.
Regards,
Ron
For some reason, the print functionality has slowed down massively.
Even using your example page http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html it takes 17secs for a print job to complete.
Do you have any idea why this has occurred or any way to solve this problem?
Thanks
Just to give a few more details:
Using Microsoft Edge 38.14393.2068.0
Windows 10 Home 1607
I have removed all anti-virus software but that made no improvement.
We have been using this successfully for years and this issue only started to occur this week.
Your demo example page confirms this for us so not a code issue on our side.
I can only assume there has been a driver update?
Hi Glyn,
We have identified the issue and are currently working on a fix. We will be releasing the fix ASAP.
Until the actual fix goes out, users can alleviate this slowdown by preventing this call. We have seen success with two methods thus far.
1: Prevent connections to 128.30.52.100 (hans-moleman.w3.org).
2: Use the windows defender firewall to prevent DYMO.DLS.Printing.Host.exe from making outbound connections.
We apologize for the inconvenience, and will update this post as soon as the situation has been resolved.
Regards,
Ron
Thanks.
I tried option 2 (blocking the outbound connection as mentioned) and saw the improvement immediately.
Thanks
Hi
I am testing the printer using the html page at http://www.labelwriter.com/software/dls/sdk/samples/js/PrintLabel/PrintLabel.html it works all good in Chrome but not in Firefox(60.0.2 (64-bit)) or IE (Microsoft Edge 42.17134.1.0)
Can you please help me with this.
Thanks
Nirav
Nirav,
Are you receiving any errors?
Hi
No I dont get any error, it just says No Printer Found I mean the javascript alert. I tried to degrade the version of Firefox and it worked with version which was very older (less then 50 I think) but as soon as I get update of Firefox it stops working. PLease advice if you have any idea how to fix this.
Thanks
Nirav
Hey,
Is it possible to print label with a dynamic markup (, , etc.)
So for example I want to be able to set all the settings just like when I print standard label, but then I want to add my labelSet with some text in bold, rather than printing single label through setObjectText which doesn’t allow me to customise my text.
I know how to print labelSet but it doesn’t get my labelXml settings applied, such as font size, bounds, paperName, etc.
Anyone can help please?
Many thanks
Are you saying that you want some of your labels in your labelset to have different formatting options or you want all of your labels in the labelset to have the formatting options?
Ron
Hi. I try to modify text value in my template but I don’t have an idea how.
My program is simple
function printAddressLabel () {
var labelXml =’LandscapeShippingfalse30323 ShippingLineRotation0FalseFalse-1FalseHorizontalLine30CenterTitleRotation0FalseFalse-1FalseCenterTopShrinkToFitTrueFalseInno4Life – VISITORTextRotation0FalseTrue-1FalseLeftTopShrinkToFitTrueFalseName:fullnameRotation0FalseFalse-1FalseLeftTopShrinkToFitTrueFalseFull NameTEXTRotation0FalseFalse-1FalseLeftTopShrinkToFitTrueFalseContact Person:contactRotation0FalseFalse-1FalseLeftTopShrinkToFitTrueFalseContactTEXT_1Rotation0FalseFalse-1FalseLeftTopShrinkToFitTrueFalseIn case of first aid emergencies please call 076 3035999′;
var label = dymo.label.framework.openLabelXml(labelXml);
//set data to print
label.setObjectText(“Text”, contactTextArea.value);
// select printer
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0)
throw “No DYMO printers are installed. Install DYMO printers.”;
var printerName = “Visitor”;
for (var i = 0; i < printers.length; ++i)
{
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}
label.print(printerName);
}
printAddressLabel ()
Printer Demo
how I can use label.setObjectText(“Text”, contactTextArea.value); if I want to change value “contact” ??
Many thanks for help
Hi Tomas,
You can view the framework documentation for this method here:
http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkdotNETHelp/html/M_DYMO_Label_Framework_Label_SetObjectText.htm
Ron
I am using Delphi XE and Dymo DLS 8 Setup 8.7.1
The problem I am having is that my app only prints labels to a 450 if I first print from the Dymo Label v8 application.
Is I do not print from my app for about 2 minutes, it will not print a label again until print from the Dymo Label v8 application…
Please advise a solution…
TIA
Hi Zane,
That is an unusual problem… perhaps you can post the code you are using to print your label.
Ron
Sorry for the delay.
I rewrote interface to use an alternate utility.
However, for the sake of completeness, here is the code that did not work for me:
if DymoAddIn1.IsPrinterOnline(FormGlobals.sv_LabelPrnType) then
begin
// DymoAddIn1.StartPrintJob;
DymoAddIn1.Open(sv_Rem30Dir + 'Dymo.label');
DymoAddIn1.SelectPrinter(FormGlobals.sv_LabelPrnType);
DymoLabels1.SetField('Address', FormGlobals.Memo2.Lines.Text);
DymoAddIn1.Print(LabelQuantity, False);
DymoAddIn1.SaveAs(sv_TempFileDir + 'rem30.lal');
// DymoAddIn1.EndPrintJob;
end
else
ShowMessage('Printer is off-line');
Hi Zane,
When your label won’t print, are there any error messages? Can you try not accessing a file from the file system, perhaps by embedding the label file xml in your application?
Ron
I’m using JavaScript plug in to print label.If i install application then only it is printing the label .
If I install only DYMO LabelWriter 450 twin turbo Drivers and SDK then it’s not printing.
How to print label without installing an application?
var printers = dymo.label.framework.getPrinters();
I’m not getting printers using drivers and SDK.
I have one more question like
For example I have 3 labels in the roll and used labelSetbuilder() method to print the label.I have given only 3 labels data to print, its printing but im getting the error like paper is out and still one label info is exist in the dymo temp location. You can see in the bottom right notification area (task bar – windows notification area)
Hi Sada,
You must install the application on all client machines to print labels.
Ron
Hello Ron,
Thanks for the response. I have one more doubt like. I’m not able to print using Edge browser and internet explorer but chrome and Firefox is working fine.
Looks like the JavaScript SDK is working only in chrome and Firefox browser.
I’m not getting printer list in Edge browser and internet explorer.
Do you have any idea?
Currently I’m using latest JavaScript file that is mentioned in the top
Can you please provide me solution to print label using Edge / Internet explorer browser?
Hi Sada,
What version of the javascript SDK are you using? We have tested on all major browsers and have had no issues (with the latest version). Older versions had issues.
Ron