Aug 102015
 

As many of you know, Google is removing support for NPAPI in the Chrome browser. Our existing JavaScript SDK utilizes this API. We have been diligently working on a new communication mechanism that will work on all browsers and will avoid such things as NPAPI and Active-X and will decouple the SDK from browser specific implementations.

The good news is that we are currently testing our new communication protocol and it will be ready for a Beta release soon.

We have worked hard to make sure that the new SDK will be backwards compatible. There will be the addition of an initialization method, but the existing API works the same.

Our new SDK will utilize TCP/IP to communicate between the browser and a Windows service running on the client machine. The new service will be installed with DLS when upgrading to the new version. A range of ports will be available for our windows service, if the browser cannot bind to one of the ports, it will fall back to our legacy plug-in architecture. For additional security, the service will accept connections only from localhost.
Stay tuned to this blog for more information.

  47 Responses to “Attention JavaScript SDK users!”

  1. This is fantastic news!! I’m looking forward to checking out/testing the beta version when it is released.

  2. That is great news, I was just starting to look for a new alternative as we need web based label printing that is quick and easy.

  3. Thanks dev team, great work!

    So I’m guessing from the phrase “windows service” that means that OSX support will follow at a later date?

    • Des, That is correct. We are working on the OSX version as well but it will not be ready for release until after the windows version. We will update the blog later with more information.

  4. Will it support SSL?

  5. Thanks for the update DYMO, really appreciate your hard work and the ability to move away from reliance on both NPAPI and Active-X. Well done and looking forward to trying this.

  6. This is great news!

    As I am sure you know, September is right around the corner and I’ve been stressing about this for months. I just hope it’s ready in time and that I will have time to ensure that things are ready on our end before google yanks NPAPI once and for all.

    • Hi Jamie, We are very much aware of the date =).
      We are trying to put the beta together as quickly as possible. I hope to have concrete news early next week.

  7. Excellent! Looking forward to the beta!

  8. Is there a way to sign up for an email alert to be notified of the coming update?

  9. I am very concerned about Mac OSX support. I’m about to launch a new product that supports DYMO printing and the vast majority (if not all) users will be on Mac OSX.

    Can you indicate how long after the Windows release the Mac support will follow?

    • Hi Kim, We are in the process of developing the Mac OSX solution. We are aiming for mid to late September to have a Beta version for the Mac. We apologize for this inconvenience.

  10. Will there be support for Chrome OS?

  11. I notice the SSL question wasn’t addressed. It is imperative that we be able to use this plugin on SSL pages, and I know from experience that Chrome will blocked mixed content requests (e.g. HTTP from an HTTPS page).

    Has this been addressed?

    • Hi Austin, We have done some testing and have discovered some limitations with our design where HTTPS is concerned. The good news is that we are looking into solutions and our plan is to fully support HTTPS on release. We will probably release another Beta for testing purposes in other environments. Details can be found in the following post: DYMO Label Framework JavaScript Library 2.0 Open Beta!:

  12. I am having trouble with this library. When I send a label with label.print() to the printer, it first prints the last label I printed then prints the new one. Any ideas why?

    • It sounds like a caching issue. Can you post a simplified version of your code so I can take a look?

      • I created the XML with the dymo tool and put it in the page. I load it, then the values, including a barcode then print it with label.print()

      • function printLabel() {
        try {
        var label = dymo.label.framework.openLabelXml(newlabelXml);
        //var labelToPrint = $(“#labelPrint”).val();
        var labelToPrint = getLabelToPrint();
        if (!label) {
        $(“#lblError”).text(“There is no information entered to print”);
        $(“#MessageDialog”).dialog({ title: “No Information” });
        $(“#MessageDialog”).dialog(“open”);
        return;
        }
        if (label.getAddressObjectCount() > 0) {
        var add = label.getAddressText(0);
        label.setAddressText(0, labelToPrint);
        }
        // set data using LabelSet and text markup
        //var labelSet = new dymo.label.framework.LabelSetBuilder();

        var textMarkup = ”;
        var fontSize = 18; // sets font size of first line

        if (labelToPrint == ”) {
        $(“#lblError”).text(“There is no information entered to print”);
        $(“#MessageDialog”).dialog({ title: “No Information” });
        $(“#MessageDialog”).dialog(“open”);
        return false;
        }
        else {
        var lines = labelToPrint.split(‘\n’);
        var boldLinesCount = lines.length <= 3 ? 1 : 2;
        for (var x = 0; x < lines.length; x++) {
        textMarkup += lines[x] + '\n';
        }
        //textMarkup += lines[0] + '\n';
        //textMarkup += lines[1] + '\n';
        //textMarkup += lines[2];
        label.setAddressText(0, textMarkup);
        label.setObjectText("Address", textMarkup);
        label.setObjectText("BARCODE", lines[0]);
        //var record = labelSet.addRecord();
        //record.setTextMarkup('Text', textMarkup); // set label text
        }
        // select printer to print on
        var printers = dymo.label.framework.getPrinters();
        if (printers.length == 0) {
        $("#lblError").text("No DYMO printers are installed. Install DYMO printers.");
        $("#MessageDialog").dialog({ title: "No Information" });
        $("#MessageDialog").dialog("open");
        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 == "") {
        $("#lblError").text("No LabelWriter printers found. Install LabelWriter printer");
        $("#MessageDialog").dialog({ title: "No Information" });
        $("#MessageDialog").dialog("open");
        return false;
        }

        // print the label and display
        try {
        //var pngData = label.render();

        //var labelImage = document.getElementById('labelImage');
        //labelImage.src = "data:image/png;base64," + pngData;
        label.print(printerName);
        }
        catch (ex) {
        alert(ex.message || ex);
        }
        }
        catch (e) {
        alert(e.message || e);
        }
        $("#divPrintWristBand").dialog("close");
        return false;
        }
        function GetDYMOPrinters() {
        var printers = dymo.label.framework.getPrinters();
        if (printers.length == 0) {
        alert("No DYMO printers are installed. Install DYMO printers.");
        $("#chkWrist").attr("disabled", true);
        }

        var printerName = "";
        for (var i = 0; i < printers.length; ++i) {
        var printer = printers[i];
        if (printer.printerType == "LabelWriterPrinter") {
        printerName = printer.name;
        break;
        }
        }
        }

      • Can you take a look at the code and tell me what may be wrong?

        • I don’t see any issue with your code. If you launch a new browser and print a label using your application, do you see the issue as well? Or does it only happen if you keep the browser open and print several times in a row?

          • This happens with a new browser everytime – I am opening a new one in my development environment each time.

  13. Great news. Will it support Windows 10? Because the current SDK only support up to Windows 8.1

    • We are doing testing on Windows 10 and the Edge browser right now. Though we may not be able to support it by the Beta, we do plan on supporting it in the future.

  14. “For additional security, the service will accept connections only from localhost.”

    Does this mean that I will be unable to use the API in the following scenario?
    – iPad with web based user interface
    – Windows machine with new service installed and Dymo printer attached
    – Both on the same local network

    On the iPad, I would like to be able to press a button to print on the Dymo printer attached to the windows computer. Am I correct to assume that this won’t be possible if you only accept connections from localhost?

    • At this point, the DYMO Framework will only have the same functionality that it does now. You will be unable to use it in the scenario that you have listed above. If our implementation is successful, we will look into expanding the functionality of the web service to accept connections outside of localhost but due to resource constraints we have not done that research yet.

      • It would be cool if you guys could implement a quick fix for this, e.g. via a registry setting. Just a suggestion. It could open up a lot of possibilities.

  15. How do I fix a caching issue?

  16. I have a unique situation. Everything was working fine until I upgraded to Windows 8.1. I installed the Dymo application and can print from that just fine. However, the 2.0Beta release of the JavaScript framework does not see any printers attached. How do I fix this?

    • Hi Dean,

      Please make sure that you are using the released versions of DLS and of the Javacscript Framework. These can be found here. You will also need to make some slight changes to your script, there is a new init method that you can find detailed here.

      If you are using the latest DLS, the upgrade to 8.1 could have messed up your installed version. I would try to uninstall and then reinstall DLS. You can also use the DYMO Label Web Service tray application to “Diagnose” and see if things are working correctly on that end.

      • Hi dymodev, does this service run only as part of 8.5.3 and newer? I am running 8.2.2.996 along with 2.0.2 framework. I am going to try to upgrade to 8.5.3 this morning to see if that helps. Is this what I should do?

      • Also, in my web application, should I include the DLLs from the Dymo installation? Which ones, if so?

  17. I am also getting this error when I run the CheckEnvironment():

    “Unable to create DYMO.Label.Framework ActiveX object. Check that DYMO.Label.Framework is installed. Exception details: Error: Automation server can’t create object”

  18. Most of the time you people sure are not much help. I am getting this error in the development tools of IE: SEC7118: XMLHttpRequest for https://localhost:41955/DYMO/DLS/Printing/StatusConnected required Cross Origin Resource Sharing (CORS).

    What is this??

    • I have the same problem. The source code is hosted on a https environment, and then the cors error occurs. How can we solve this?

      • Hi Christopher,

        Make sure you are using the latest version of our Javascript SDK and the latest version of DLS on the client. This issue was resolved in these releases a few months ago.

        Ron

  19. I installed the new 8.5.3 app and the 2.0.2 JS framework. The checkEnvironment result is very positive now. However, when I construct a label like I did before and then call label.print() I receive a 400 error, bad request. What is this and how can I fix it?

  20. I have an issue with trying to change the font size of the text. This is the X<ML I am loading:

    var addressLabelXml = '\
    \
    Landscape\
    Address\
    30252 Address\
    \
    \
    \
    \
    \
    Address\
    \
    \
    \
    Rotation0\
    False\
    True\
    Left\
    Top\
    ShrinkToFit\
    True\
    False\
    \
    False\
    AboveAddress\
    \
    \
    \
    \
    \
    \

    And here is my function to print:

    function printAddressLabel(data, showOrPrint, imgId) {
    try {
    var label = dymo.label.framework.openLabelXml(labelXmlNoBarcode);
    var labelToPrint = getLabelToPrint(data);
    if (!label) {
    $(“#lblError”).text(“There is no information entered to print”);
    $(“#MessageDialog”).dialog({ title: “No Information” });
    $(“#MessageDialog”).dialog(“open”);
    return;
    }
    if (label.getAddressObjectCount() > 0) {
    var add = label.getAddressText(0);
    label.setAddressText(0, labelToPrint);
    }
    // set data using LabelSet and text markup

    var textMarkup = ”;

    if (labelToPrint == ”) {
    $(“#lblError”).text(“There is no information entered to print”);
    $(“#MessageDialog”).dialog({ title: “No Information” });
    $(“#MessageDialog”).dialog(“open”);
    return false;
    }
    else {
    var lines = labelToPrint.split(‘\n’);
    var boldLinesCount = lines.length <= 3 ? 1 : 2;
    for (var x = 0; x < lines.length; x++) {
    textMarkup += lines[x] + '\n';
    }
    label.setAddressText(0, textMarkup);
    label.setObjectText("Address", textMarkup);
    //label.setObjectText("BARCODE", lines[0]);
    }
    // select printer to print on
    var printers = dymo.label.framework.getPrinters();
    if (printers.length == 0) {
    $("#lblError").text("No DYMO printers are installed. Install DYMO printers.");
    $("#MessageDialog").dialog({ title: "No Information" });
    $("#MessageDialog").dialog("open");
    $("#patientWristcb").prop("disabled", true);
    $("#patientcb").prop("disabled", true);
    $("#patientcbal").prop("disabled", true);
    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 == "") {
    $("#lblError").text("No LabelWriter printers found. Install LabelWriter printer");
    $("#MessageDialog").dialog({ title: "No Information" });
    $("#MessageDialog").dialog("open");
    return false;
    }

    // print or show the label
    try {
    if (showOrPrint === 'print') {
    label.print(printerName);
    }
    else {
    var pngData = label.render();

    var labelImage = document.getElementById(imgId);
    labelImage.src = "data:image/png;base64," + pngData;
    imgHeight = labelImage.clientHeight;
    imgWidth = labelImage.clientWidth;
    }
    }
    catch (ex) {
    alert(ex.message || ex);
    }
    }
    catch (e) {
    alert(e.message || e);
    }
    return false;
    }

    No matter what I set the font size to in the XML it never changes. What am I doing wrong here?

    • Make sure the fit mode of your text object is set to ‘None’, otherwise any changes to font size will be ignored.

  21. I cannot change the font size no matter what I do. How do you control the font size?

  22. Here is my function:

    function printAddressLabel(data, showOrPrint, imgId) {
    try {
    var label = dymo.label.framework.openLabelXml(labelXmlNoBarcode);
    var labelToPrint = getLabelToPrint(data);
    if (!label) {
    $(“#lblError”).text(“There is no information entered to print”);
    $(“#MessageDialog”).dialog({ title: “No Information” });
    $(“#MessageDialog”).dialog(“open”);
    return;
    }
    if (label.getAddressObjectCount() > 0) {
    var add = label.getAddressText(0);
    label.setAddressText(0, labelToPrint);
    }
    // set data using LabelSet and text markup

    var textMarkup = ”;

    if (labelToPrint == ”) {
    $(“#lblError”).text(“There is no information entered to print”);
    $(“#MessageDialog”).dialog({ title: “No Information” });
    $(“#MessageDialog”).dialog(“open”);
    return false;
    }
    else {
    var lines = labelToPrint.split(‘\n’);
    var boldLinesCount = lines.length <= 3 ? 1 : 2;
    for (var x = 0; x < lines.length; x++) {
    textMarkup += lines[x] + '\n';
    }
    label.setAddressText(0, textMarkup);
    label.setObjectText("Address", textMarkup);
    //label.setObjectText("BARCODE", lines[0]);
    }
    // select printer to print on
    var printers = dymo.label.framework.getPrinters();
    if (printers.length == 0) {
    $("#lblError").text("No DYMO printers are installed. Install DYMO printers.");
    $("#MessageDialog").dialog({ title: "No Information" });
    $("#MessageDialog").dialog("open");
    $("#patientWristcb").prop("disabled", true);
    $("#patientcb").prop("disabled", true);
    $("#patientcbal").prop("disabled", true);
    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 == "") {
    $("#lblError").text("No LabelWriter printers found. Install LabelWriter printer");
    $("#MessageDialog").dialog({ title: "No Information" });
    $("#MessageDialog").dialog("open");
    return false;
    }

    // print or show the label
    try {
    if (showOrPrint === 'print') {
    label.print(printerName);
    }
    else {
    var pngData = label.render();

    var labelImage = document.getElementById(imgId);
    labelImage.src = "data:image/png;base64," + pngData;
    imgHeight = labelImage.clientHeight;
    imgWidth = labelImage.clientWidth;
    }
    }
    catch (ex) {
    alert(ex.message || ex);
    }
    }
    catch (e) {
    alert(e.message || e);
    }
    return false;
    }

    The XML will not take here.

  23. How do I set the barcode to print at the bottom of the label? This is my XML:

    ‘\
    \
    Landscape\
    Address\
    30252 Address\
    \
    \
    \
    \
    \
    Address\
    \
    \
    \
    Rotation0\
    False\
    True\
    Left\
    Top\
    None\
    False\
    False\
    \
    False\
    Suppress\
    \
    \
    \
    \
    \
    \
    \
    \
    BARCODE\
    \
    \
    \
    Rotation0\
    False\
    False\
    \
    Code39\
    Medium\
    None\
    \
    \
    None\
    0\
    Center\
    Bottom\
    \
    \
    \
    \

  24. We need to have the framework function with Chrome. We are in a very restricted environment and cannot control a lot of chrome settings. We are using version 8.5.3.1897 of the framework because nothing else seems to work with IE and no version works with chrome. Is there some specific setting in chrome that will allow the framework to load and function?

    • Hi Dean,

      Everything should work fine with all browsers if you use the latest version of the javascript SDK and DLS 8.7.3.

      Ron

Leave a Reply to Dean DePue Cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)