Printing ZPL from a file

The Direct/RAW printing capability is intended for sending byte streams of printer control scripts in a language such as ZPL. It is assumed that the correct paper is loaded to the printer so the  API is simple, providing for selecting a printer and then sending a string or the content returned from a url.

The use of the ScriptX Client libraries and the meadco-scriptx-1.10.1.js library simplifies the use of the Services REST API.

<script src="/scripts/meadco-scriptx-1.10.1.js" type="text/javascript"></script>
<script src="/scripts/meadco-core.js"></script>
<script src="/scripts/meadco-scriptxprint.js"></script>
<script src="/scripts/meadco-scriptxfactory.js"></script>
<script src="/scripts/meadco-scriptxprintlicensing.js"></script>
<script src="/scripts/meadco-secmgr.js"></script>

Then the same code works:

window.addEventListener("load", async () => {
    var sLabel = "^XA^FO50,50^ADN,36,20,^FDScriptX RawPrinting^FS^FO50,100^ADN,36,20,^FDMead & Company^FS^XZ";
    try {
        await MeadCo.ScriptX.InitAsync();

        document.getElementById("btn-print").addEventListener("click", () => {
            MeadCo.ScriptX.DirectPrintString(document.getElementById("availablePrinters").value, sLabel);
        });
    catch(e) {
        app.Messages.ErrorBox("Unable to initialise ScriptX: " + e);
    }
});
    

The Direct/RAW printing capability is intended for sending byte streams of printer control scripts in a language such as ZPL. It is assumed that the correct paper is loaded to the printer so the API is simple, providing for selecting a printer and then sending a string or the content of a file.

Please select a ZPL compatible printer:  Print: