How To Print Images from Android(java) to Zq220 zebra printer using CPCL language

// Expert user has replied.
Y Yanis Dalabiras 1 year 11 months ago
392 2 0

I've been printing to a ZQ200 printer using Android (Java), but I want to print an image. But the GitHub demo program only works with ZPL Command, and I can't seem to find any resources to print a picture from CPCL Command. One thing that occurs to me is altering the printer language, but I am unable to do so. I called the Zebra Support team, who informed me that I cannot do so because the printer only supports ZPL. I'm stuck as a result; if you could, would you?

Please Register or Login to post a reply

2 Replies

S Steven Si

Use the Link-OS SDK for Android, which provides a GraphicsUtil class where you can find the printImage() API that converts the image file into bitmap data wrapped around with the CPCL commands and sends to the printer. To print on the ZQ220 printer, you would need to specify the printer language as CPCL when getting the printer instance. Without specifying the printer language as CPCL, the printImage() API would send the data as ZPL to the ZQ220. This wouldn't work, as the ZQ220 is a CPCL printer.

Here is the code snippet

private void sendImage2Printer( String imageFilePath) {
    new Thread(new Runnable() {
        public void run() {
            try {
                Connection connection = new BluetoothConnection(getMacAddressFieldText());
                connection.open();
                ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.CPCL, connection);
                printer.printImage(imageFilePath, 0, 0, 550, 412, false);

                connection.close();

            } catch (ConnectionException e) {
                // Do something
            } finally {
                // Do something
            }
        }
    }).start();
}

 

s solomon mulatu

I appreciate your help a lot, it saved me time

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