Which SDK to use for Zebra KR203?

// Expert user has replied.
O Omar Barrera 3 years 4 months ago
9 1 0

I tried to connect to my printer zebra KR203 for Kiosk, I downloaded link-os-sdk.
 
I´m programming with JAVA this is my code, I want to get the printers connected:
 
package logic;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.printer.discovery.*;
public class Inicio {
public static void main(String[] args) throws ConnectionException {
        try {
            for (DiscoveredPrinterDriver printer : UsbDiscoverer.getZebraDriverPrinters()) {
                System.out.println(printer);
            }           
            for (DiscoveredUsbPrinter usbPrinter : UsbDiscoverer.getZebraUsbPrinters()) {  // My line 10
                System.out.println(usbPrinter);
            }
        } catch (ConnectionException e) {
            System.out.println("Error discovering local printers: " + e.getMessage());
        }
}
}
 
But when I run my app I get this error:
Exception in thread "main" java.lang.NullPointerException
at com.zebra.sdk.printer.discovery.UsbDiscoverer.getZebraUsbPrinters(Unknown Source)
at logic.Inicio.main(Inicio.java:10).
 
My working directory is "C:\Program Files\Zebra Technologies\link_os_sdk\PC\v2.9.2275\lib"
 
I do not know if the error is my code or isn´t it possible to connect to my printer for incompatible with the SDK, Can anyone help me please?
 
On the other hand is possible print with the PrintService of JAVA  code, example:
 
FileInputStream inputStream = inputStream = new FileInputStream("C:/Temp/ticket.txt");
DocFlavor docFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc document = new SimpleDoc(inputStream, docFormat, null);
PrintRequestAttributeSet attributeSet = new HashPrintRequestAttributeSet();
PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
if (defaultPrintService != null) {
String print_default = defaultPrintService.getName();
DocPrintJob printJob = defaultPrintService.createPrintJob();
try {
  printJob.print(document, attributeSet);
} catch (Exception er) {
  log.error("Error al imprimir: " + er.getMessage());
}
}

Please Register or Login to post a reply

1 Replies

t testtt test

Omar,
Unfortunately the KR203 printer is not supported by the Link-OS SDK. If you want to use the Link-OS SDK with a kiosk printer, the KR403 would be the unit to use.
The toolset for the KR203 is focused on print drivers across several different operating system.

CONTACT
Can’t find what you’re looking for?