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

// Expert user has replied.
D Diego Meretta 3 years 6 months ago
49 2 0

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:
 

 
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 graphicsData = new ArrayList();
            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

Please Register or Login to post a reply

2 Replies

M Manuel Caicedo-Rivera

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

M Manuel Caicedo-Rivera

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-serie…

Thanks,
MC

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