Print from browser directly to Dymo LabelWriter

In this post I explain how one can print immediately to the Dymo LabelWriter just by pressing a button in your web app. The printer dialog will be omitted which has two mayor benefits:

  1. Saving you the time to select the correct paper-size and printer.
  2. Prevents you from accidentally printing on the Dymo (because the last printer used in the printer dialoge is most often preselected).

Setup the Software

One needs the following tools:

Since August 2016 the DYMO Label Web Service is directly installed with the DYMO Label Software. To check if you have the Web Service correctly installed, you might want to follow this blog here (Linux is not supported :/).

There is also a SDK that you may download here. However, I would not recommend to waste your time with that. All JS examples from the framework in the SDK are broken. There is a 5 page Framework-PDF-Overview which is not really helpful. Instead, I would take a look at the examples from this blog post and this documentation.

You can't use the framework to print a pdf. Instead, the only way to print labels through the framework is by creating a label through an XML. There is no documentation anywhere how these XML are created, but you can use the DYMO Label Software to create these XML files. You can add multiple images and text sections that you can place on your label and you modify them with the framework. There is a 80 page SDK documentation (not for the framework but for lower code) and exactly 0 example for JS. This is only useful if your a C++ coder who wants to do more complex things than printing a label with an XML file and the framework.


I created with the DLS a label in the format "30321 Large Address" that only contained one large image that I called `image`. I created a function that returns the labelXML format:

  getImageLabelXml() {

     var labelXml = '<?xml version="1.0" encoding="utf-8"?>\
                     <DieCutLabel Version="8.0" Units="twips">\
                         <PaperName>30321 Large Address</PaperName>\
                             <RoundRectangle X="0" Y="0" Width="2025" Height="5020" Rx="270" Ry="270" />\
                                 <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />\
                                 <BackColor Alpha="0" Red="255" Green="255" Blue="255" />\
                                 <BorderColor Alpha="255" Red="0" Green="0" Blue="0" />\
                             <Bounds X="322" Y="57.9999999999999" Width="4613" Height="1882" />\

     return labelXml;

The following codes connects to the printer, loads the above XML Label, replaces the "Image" with an image loaded from some url, and then prints it:

       if (!this.printer){
               throw "No DYMO printers are installed. Install DYMO printers.";
       var printer = this.printer.modelName;

       // create label from XML file
       var stampi      = dymo.label.framework.openLabelXml(this.getImageLabelXml());
       // load image from url and store as Base64
       var stampi_image = dymo.label.framework.loadImageAsPngBase64(url);

       // overwrite image "Image" from XML label with loaded image
       stampi.setObjectText('Image', stamp_image);

       // print it
          alert(e.message || e, false);

      var printers = dymo.label.framework.getLabelWriterPrinters();
      if (printers.length == 0)
          alert("No DYMO printers are installed. Install DYMO printers.");
      // assuming there is only one printer
      this.printer = printers[0];

Leave a comment

Your email address will not be published. Required fields are marked *