Use the Link-OS SDK with Non-Link-OS Printers

Steven Si -
3 MIN READ
419
10

Through the interactions with our Zebra developer community, we continue to see Link-OS Multiplatform SDK play a big role in developing printing apps to meet the label and receipt printing needs with Zebra Link-OS printers. From time to time, we have developers ask, “Can I use Link-OS SDK to develop apps for non-Link-OS printers?” or “Does Link-OS SDK support non-Link-OS printers?”

Link-OS vs Non-Link-OS

Before answering the above questions, let us understand what the Link-OS is. The Link-OS is a collective term for a suite of software and tools that make it simple to design and adapt a label/receipt printing application and to configure, manage and maintain the printers. In other words, the Link-OS comprises three parts at a high level: standalone applications (tools/utilities), software SDK and the printer firmware. This Zebra Link-OS Features Guide summarizes very well on what Link-OS offers. We will not go into the details of each Link-OS feature in this article.

Through the years, most Zebra printer models are developed based on the Link-OS architecture to adapt the latest technologies. These printer models, as listed on the Zebra Link-OS Features Guide, are called Link-OS printers. All the other models that are not listed on this Zebra Link-OS Features Guide are called non-Link-OS printers, which includes the legacy models and some newer models. Yes, Zebra continues to make non-Link-OS printers for specific markets and verticals. In general, the non-Link-OS printer models have reduced features and reduced capability. But there are things in common between Link-OS and non-Link-OS printers, such as connectivity (Wireless, Wired, Bluetooth or USB) equipped across all printer models.

Using Link-OS SDK with non-Link-OS Printers

Because there are commonalities between Link-OS printers and non-Link-OS printer, the Link-OS SDK can still be used to develop apps for non-Link-OS printer. We will highlight the major components in Link-OS SDK that are still applicable to non-Link-OS printers.

  1. Printer Discovery

The Printer Discovery related API can still be used for discovering non-Link-OS printers that are connected to the network, USB or sending Bluetooth advertisement packets.

  1. Printer Connectivity

The Printer Connectivity related API can also be used for making a connection to non-Link-OS printers through IP address, Bluetooth MAC address or USB ID string. Once the connection is established, you can communicate with the printer through read or write API.

  1. SGD

Once the connection is established, you can use SGD API to send configuration commands to the non-Link-OS printers. Just be aware, the non-Link-OS printers have a reduced set of SGD commands. Check the manual for supported SGD commands for the specific non-Link-OS printer.

  1. Printer Factory

When using Printer Factory API, use the API that return the ZebraPrinter instance for non-Link-OS printers. The API that return ZebraPrinterLinkOs instance is not applicable for non-Link-OS printers.

  1. Template Filling & Graphics Conversion

The Template Filling and Graphics Conversion API are based on ZPL format language. If the non-Link-OS printers have the ZPL capability and the ZPL format language is enabled, then the application can use these API.

  1. Printer Status Checking

The Printer Status Checking API is part of the ZebraPrinter object. The API can be used for checking the operational status of non-Link-OS printers, such as Paper Out, Head Open, etc.

The other unmentioned components in the Link-OS SDK are not application to non-Link-OS printers. As always, your comments and feedback are welcome. Happy coding!

profile

Steven Si

Please Register or Login to post a reply

10 Replies

I Ivano Luberti

Hi what you exactly mean with

  1. Printer Status Checking

The Printer Status Checking API is part of the ZebraPrinter object. The API can be used for checking the operational status of non-Link-OS printers, such as Paper Out, Head Open, etc.

What are Printer Status Checking API? Is it the getCurrentStatus() command? Beacuse is not working for me with non non-Link-OS printers

S Steven Si

What do you mean that the getCurrentStatus() not working with the non-Link-OS printers? Can you share the code snippet? Here is an example of how to call this API on a non-Link-OS printer.

using System;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;

public class PrinterStatusExample {

    public static void Main(string[] args) {
        Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);
        try {
            connection.Open();
            ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);

            PrinterStatus printerStatus = printer.GetCurrentStatus();
            if (printerStatus.isReadyToPrint) {
                Console.WriteLine("Ready To Print");
            } else if (printerStatus.isPaused) {
                Console.WriteLine("Cannot Print because the printer is paused.");
            } else if (printerStatus.isHeadOpen) {
                Console.WriteLine("Cannot Print because the printer head is open.");
            } else if (printerStatus.isPaperOut) {
                Console.WriteLine("Cannot Print because the paper is out.");
            } else {
                Console.WriteLine("Cannot Print.");
            }
        } catch (ConnectionException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
        }
    }
}

 

I Ivano Luberti

Here is my snippet .

If   printerStatus = printer .getCurrentStatus(); is executed I get

Malformed status response - unable to determine printer status

with a GK420

    public GenericPrinterStatus getStatus() throws PrinterConnectionException  {

        try {

            if(imz==null || !imz.isConnected()) {
                imz = new UsbConnection(address, maxTimeoutForRead, timeToWaitForMoreData);
                imz.open();
                printer = ZebraPrinterFactory.getInstance(imz);
                linkOsprinter = ZebraPrinterFactory.createLinkOsPrinter(printer);
                //if (linkOsprinter == null)
                //    printer = ZebraPrinterFactory.getInstance(imz);
            }
            
            PrinterStatus printerStatus = null;
            
            if (linkOsprinter != null) {
                printerStatus = linkOsprinter.getCurrentStatus();
            } else {
                printerStatus = printer .getCurrentStatus();
 
            }

            return convertZebraPrinterStatusToGenericStatus(printerStatus);
            


        } catch (ConnectionException | ZebraPrinterLanguageUnknownException e) {
            throw new PrinterConnectionException("Errore nel tentativo di connessione alla stampante: "+e.getMessage());
        }

        
    }

 

S Steven Si

When you call the printer = ZebraPrinterFactory.getInstance(imz), make sure the device.languages on the GK420 is set to ZPL. If the device.languages is set to EPL on the GK420, then you will get the malformed status response error.

I Ivano Luberti

This is not the case. Printing the configuration label shows the language is ZPL. And I was already using that printer with another client, nont based on Link-oS SDK, using ZPL

S Steven Si

I have a GK420d printer connects to my PC via USB. The device.languages on the GK420d is set as ZPL. The getCurrentStatus() returns successfully. I only get the malformed error if the device.languages is switched to EPL. Not sure why it doesn't work for you. Could the maxTimeoutForRead and timeToWaitForMoreData be too short? In my case, I set both of them to 500, which is the default.

I Ivano Luberti

Thanks Steven, I will try and let you know

I Ivano Luberti

Hi Steven I was able to find the cause. Since my software has to use both Link-OS e NON Link-OS printers I had written the following code:

            printer = ZebraPrinterFactory.getInstance(imz);
            linkOsprinter = ZebraPrinterFactory.createLinkOsPrinter(printer);

            PrinterStatus printerStatus = null;
            if (linkOsprinter != null) {
                printerStatus = linkOsprinter.getCurrentStatus();
            } else {
                printerStatus = printer.getCurrentStatus();

            }

I had to change it to

            printer = ZebraPrinterFactory.getInstance(imz);
            linkOsprinter = ZebraPrinterFactory.createLinkOsPrinter(printer);
            if (linkOsprinter == null)
                printer = ZebraPrinterFactory.getInstance(imz);

So if ZebraPrinterFactory.createLinkOsPrinter(printer) fails I have to call again ZebraPrinterFactory.getInstance(imz);.

Thanks for your help

S Steven Si

"So if ZebraPrinterFactory.createLinkOsPrinter(printer) fails I have to call again ZebraPrinterFactory.getInstance(imz);."

Thank you Ivano for figuring this out. It's brilliant.

I Ivano Luberti

you are welcome.

Let me add a little detail: it was really measleading that in the first mode the software was able to print. The getStatus was not working but  

printer.sendCommand(label);

was working properly.

That drove me in the direction of incompatibility