2 Replies Latest reply on Dec 17, 2018 1:20 AM by Alex Alex

    ZebraPrinterLinkOs always null

    Alex Alex

      Hello,

      Can you help me please,

      I want  upload my fonts from android device to the printer memory.

      in the code below, object ZebraPrinterLinkOs  always null . Where is my problem?(I'm using printer zd410)

       

      Connection connection = new BluetoothLeConnection(macAddress, this);

      ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, connection);

      Thread.sleep(10000);

      ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(printer, PrinterLanguage.ZPL);

      linkOsPrinter.downloadTtfFont("/storage/emulated/0/fonts/DroidItalic.ttf", "Z:");  // exception, linkOsPrinter is null

       

      Thank you in advance

        • Re: ZebraPrinterLinkOs always null
          Robin West

          Hi Alex,

          You need to open the connection before using the ZebraPrinterFactory.  It checks a few settings on the printer to set up the ZebraPrinterLinkOS object.  You also don't need the 10 second sleep after creating the ZebraPrinter.

          Something like this should work:

          Connection connection = new BluetoothLeConnection(macAddress, this);
          connection.open();
          ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, connection);
          ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(printer, PrinterLanguage.ZPL);
          linkOsPrinter.downloadTtfFont("/storage/emulated/0/fonts/DroidItalic.ttf", "Z:");