All Dymo software, including the packaged label printing software and the programmers’ API, use the Dymo lwl file format to store information regarding the formating of labels. This shows the positioning of the textual content, the field names, default values and any clip art/images which may be present by default.
More information about Dymo lwl files and Dymo software programming in general is available via Dymo specific posts.
Posted on 17-08-2008 under
ActiveX,
API,
application development,
Dymo,
Dynamo,
Javascript,
label printer,
programming,
software development,
VBScript,
web development
Dymo is a company that creates an unbelievably popular range of label printers, although if you have arrived here you probably already know that.
If you are a developer looking for a way to utilise Dymo label printers outside of their label printing software then you are need to take a look at Dymo’s website where a downloadable API is available in many formats. These include web development based scripting languages such as VBScript and Javascript. More useful for in application development is the Dymo ActiveX control. In addition, for web-based software applications, we have a guide for the Dymo VBScript API.
Just a side-note: Dymo label printers are often misspelt as ‘Dynamo’, which is obviously incorrect but it is worth noting as many descriptions, tutorials and code snippets misspell the company name in that manner.
A useful code snippet for you here. It’s a PHP script which calls in the Dymo label printer ActiveX control, and prints out what it finds in various $_GET variables.
<?
// This will print a label via dynamo’s ActiveX controls (so must be using IE) –>
// You should pass $_GET variables to be printed: line1, line2, line3, line4, line5, line6
?>
<SCRIPT LANGUAGE=VBScript>
Dim DymoAddIn, DymoLabel
Set DymoAddIn = CreateObject(“DYMO.DymoAddIn”)
Set DymoLabel = CreateObject(“DYMO.DymoLabels”)
DymoAddIn.Open “C:\Documents and Settings\All Users\Documents\DYMO Label\Label Files\Address (30252, 30320).LWL”
DymoLabel.SetAddress 1, “<?= $_GET['line1'] ?>” + chr(10) + “<?= $_GET['line2'] ?>” + chr(10) + “<?= $_GET['line3'] ?>” + chr(10) + “<?= $_GET['line4'] ?>” + chr(10) + “<?= $_GET['line5'] ?>” + chr(10) + “<?= $_GET['line6'] ?>”
DymoAddIn.Print 1, true
</SCRIPT>
Things of note include the path to the label. The code is written to work with Windows XP (C:\Documents and Settings\) so may need altering for Windows Vista (C:\Users\). Although Vista is supposed to be able to compensate for this kind of backwards compatability I have not been able to test this code on Vista as of yet. Also, of course, the LWL label file can be changed to any that are currently installed.
chr(10) is the how we output our new line character in VBScript. Also, as you’re probably aware as VBScript is calling in two ActiveX controls you’ll have to make sure the end-user is using Internet Explorer.