Printing Dymo labels using the list JS plugin

m6xmed5

Member
Just posting this in case it's useful to someone.
You can print labels straight from the browser using Fabrik, DYMO's labelwriter 450 and the framework and software that goes with it.

1. Install the labelwriter software and webservice on the machine you want to print from.
2. Upload the latest framework file to your webserver
3. Include the following tag in your page header
HTML:
<script src = "http://yoursite/libraries/dymo/DYMO.Label.Framework.latest.js" type="text/javascript" charset="UTF-8"> </script>
4. Create a label template and upload it to your server (make sure you name each element so you can reference it in your list js code.
5. Add the listjs plugin to the list whose data you want to print.
6. Add your code to the plugin, my code to print three elements was as follows
JavaScript:
function loadScript(url, callback)
{
    // Adding the script tag to the head as suggested before
    var head = document.getElementsByTagName('head')[0];
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = "http://yoursite/libraries/dymo/DYMO.Label.Framework.latest.js";

  
  
    script.onreadystatechange = callback;
    script.onload = callback;

    // Fire the loading
    head.appendChild(script);
}


function loadPrinters()
        {
            var printers = dymo.label.framework.getPrinters();
            if (printers.length === 0)
            {
                alert("No DYMO printers are installed.");
                return;
            }

            for (var i = 0; i < printers.length; i++)
            {
                var printerName = printers[i].name;

                var option = document.createElement('option');
                option.value = printerName;
                option.appendChild(document.createTextNode(printerName));
               
            }
      
      
       
        }
       

        function LabelXml() {
jQuery.each(rows, function(rowid, row) {
var label =
dymo.label.framework.openLabelFile("http://yoursite/libraries/dymo/your.label");
            label.setObjectText("Labelref1", row.table___element);
            label.setObjectText("labelref2", row.table___element);
            label.setObjectText("labelref3", row.table___element);
            label.print("DYMO LabelWriter 450");
                  
            })
}

        // load printers list on startup and print
        loadPrinters();  LabelXml();

Hope this helps someone out there.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top