Error after printing a card: SDK: Bad ZMC command echo.

Greetings.

I'm developing an aplication based in Java for printing and encoding magnetic cards from a Zebra ZXP Series 3 printer. After printing a card, when i attempt to print the second card the error "SDK: Bad ZMC command echo" appears in the stack trace of a Connection exception when performing a new connection to the printer. Here´s a picture of the stack trace:

 

Error 1.PNG

 

Here`s the code of the printing method that i use:

 

public static void imprimirYMagnetizar(DiscoveredPrinter impresoraEncontrada, String[] tracks,

            BufferedImage imgFrente, BufferedImage imgDorso) {

 

        ZebraCardPrinter zebrap = null;

        ZebraCardGraphics graphics = null;

        try {

            zebrap = ZebraCardPrinterFactory.getZxpPrinter(conectoImpresora(impresoraEncontrada));

            List<GraphicsInfo> graphicsData = new ArrayList<GraphicsInfo>();

            graphics = new ZebraCardGraphics(zebrap);

 

            // Front Image

            graphics.initialize(0, 0, OrientationType.Landscape, PrintType.Color, Color.WHITE);

            graphics.drawImage(graphics.imageToImageData(imgFrente), 0, 0, 1017, 638, RotationType.Rotate180FlipNone);

 

            // graphics configuration of the front image

            GraphicsInfo grInfo = new GraphicsInfo();

            grInfo.graphicData = graphics.createImage();

            grInfo.side = CardSide.Front;

            grInfo.printType = PrintType.Color;

            grInfo.graphicType = GraphicType.BMP;

            graphicsData.add(grInfo);

            graphics.clear();

 

            // Front overlay

            grInfo = new GraphicsInfo();

            grInfo.graphicData = null;

            grInfo.side = CardSide.Front;

            grInfo.printType = PrintType.Overlay;

            grInfo.graphicType = GraphicType.NA;

            graphicsData.add(grInfo);

 

            // Back image

 

            graphics.initialize(0, 0, OrientationType.Landscape, PrintType.Color, Color.WHITE);

            graphics.drawImage(graphics.imageToImageData(imgDorso), 0, 0, 1017, 638, RotationType.Rotate180FlipNone);

 

            // Graphics configuration of the back image

 

            grInfo = new GraphicsInfo();

            grInfo.graphicData = graphics.createImage();

            grInfo.side = CardSide.Back;

            grInfo.printType = PrintType.Color;

            grInfo.graphicType = GraphicType.BMP;

            graphicsData.add(grInfo);

            graphics.clear();

 

            // Back overlay

 

            grInfo = new GraphicsInfo();

            grInfo.graphicData = null;

            grInfo.side = CardSide.Back;

            grInfo.printType = PrintType.Overlay;

            grInfo.graphicType = GraphicType.NA;

            graphicsData.add(grInfo);

 

            // Performing the printing job

 

            int jobId = zebrap.printAndMagEncode(1, graphicsData, tracks[0], tracks[1], "");

 

            // Method for controlling the printing job (i wait until the job status is "done_ok")

            controlarTrabajo(zebrap, jobId);

 

            graphics.close();

            zebrap.destroy();

            zebrap.getConnection().close();

 

            if (zebrap.getConnection().isConnected()) {

                System.out.println("Sigue abierta la conexion");

            } else {

                System.out.println("Se cerro");

            }

 

        } catch (ConnectionException e) {

            System.out.println("Error en la conexión.");

            e.printStackTrace();

        } catch (ZebraCardException e) {

            System.out.println("Ocurrio un error en la impresora.");

            e.printStackTrace();

        } catch (SettingsException e) {

            e.printStackTrace();

        } catch (IllegalArgumentException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();

        } catch (ZebraIllegalArgumentException e) {

            e.printStackTrace();

        }

 

    }

 

What I do first is discover the printer outside this method, and then passing the instance of the Discovered Printer by reference. Then in the printing method that i made, I attempt to open a Connection to the printer and then create a Zebra Card Printer with that connection. Then I instance the Zebra Card Graphics class with the instance of the zebra printer. After the printing job is done, I perform a clean up closing the graphics, destroying the printer and then closing the connection. But I don't know why I'm not able to connect the printer again because of said error. Please if you have some information of what is that error message I would appriciate knowing why it happens. If you need more detail I would happily give it to you. I wait for your response. Best Regards

Manuel Caicedo-...
Hi Diego,Did you test the

Hi Diego,

Did you test the sample code that came with the Java SDK? If so, this worked correctly with your ZXP 3 printer?

I assume you have the latest version of our SDK & firmware of the printer. You can verify versions on the links below.

Link-OS Multiplatform SDK | Zebra

ZXP Series 3 Card Printer Support & Downloads | Zebra

Also, you can open a case with tech support on the link below

Zebra Customer Community https://supportcommunity.zebra.com/s/topic/0TOi00000009o0ZGAQ/zxp-series-3?language=en_US&tabset-89b58=2

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Diego Meretta
Hi Manuel, sorry for replying

Hi Manuel, sorry for replying late.

I have tested the sample code that came with the Java SDK and a sample that was sent to me via e-mail by the Zebra support. Both of them worked with my ZXP 3, but both codes impements one printing job per run, I was wondering if there was an example where more than one prinitng job was implemented, because that is what I'm trying to do, but as I said in the question, I was not being able to connect to the printer once the printing job finished.

I tried to close the graphics and closing the connection to the printer, and then destroying the ZebraPrinterZxp instance and then with the same instance of the DiscoveredPrinter perform a new connection to the ZXP 3, but again this does not work.

I just need an example on how to perform succesfull and consecutives printing jobs without closing the application or resetting

Thank you so much for your help.

Best Regards.

DM

P.D: I'm using the Zebra Card Api version 2.11.3782, the SN of the printer is Z3J161200470 and the firmware version is ZXP320M00 V02.14.00.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Diego,It looks that you have

Diego,

It looks that you have a version that it is not the latest. Please, download the version v.2.12.3968 from the link below

Link-OS Multiplatform SDK | Zebra

Please, once you have downloaded the Multi-platform SDK, for card printers, select and open the folder called PC-Card. The new SDK has fixed some bugs.

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Diego Meretta
Manuel, thanks. It worked

Manuel, thanks. It worked after upgrading to the version v.2.12.3968, even with the same code that I wrote.

Best Regards,

DM.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments