Print image with ZQ210 mobile printer

// Expert user has replied. //Solved
P Peter Kolocz 1 year 9 months ago
136 4 1

I have a ZQ210 printer with which I want to print unique labels (which are an image) on a 35x30mm label. However, after printing, the printer creates an extra space and thus goes into the next label area. I would definitely need to be able to print on the entire label area, without the printer leaving more space. Is there any solution or option for this?

Please Register or Login to post a reply

Accepted Solution

S Steven Si

ZQ210 is a CPCL printer. I'd recommend to use ZebraDesigner 3 to help design the label with image and then output the *.prn file in CPCL. You can do a few test print to make sure it doesn't exceed the label boundary before generating the output file. Of course, you need too calibrate the ZQ210 with the media first.

4 Replies

S Steven Si

ZQ210 is a CPCL printer. I'd recommend to use ZebraDesigner 3 to help design the label with image and then output the *.prn file in CPCL. You can do a few test print to make sure it doesn't exceed the label boundary before generating the output file. Of course, you need too calibrate the ZQ210 with the media first.

P Peter Kolocz

how can I calibrate the printer to detect the dimensions of the label?

Implementation-Title: Link-OS Multiplatform SDK
Implementation-Version: 2.14.5198

I'm currently using this for printing:
try {
    if (null == printer) {
        printer =
            ZebraPrinterFactory.getInstance(
                PrinterLanguage.CPCL,
                connection
            )
    }
} catch (e: ConnectionException) {
    disconnectPrinter()
    return PrinterDeviceStatus.NOT_CONNECTED
}

 

printer!!.printImage(ZebraImageAndroid(preview), 60, 0, 300, 164 /*200*/, false)
S Steven Si

You need to take out the ZQ210 User Guide and follow the instructions on the guide to calibrate the printer. The guide also has specifications about the types of the label media supported by the ZQ210 printers. You cannot detect the label length programmatically with ZQ210 printers. You may add a UI to allow the user to specify the label dimension for the app.

P Peter Kolocz

i would use this code to print the bitmap:

I used the printImage method of GraphicsUtilCpcl and added the "GAP-SENSE" command, with which the printer can monitor the label boundaries, but my problem is that the printing fails, even though my code is built on the same basis as the original code. What could be the problem?

 

@Throws(ConnectionException::class)
private fun printImage(
    printerConnection: BluetoothConnection,
    bitmap: Bitmap,
    quantity: Int
) {
    val bitmapPreview: Bitmap = scaleImage(250, 214, bitmap)
    val ByteWidth: Int = (bitmap.width + 7) / 8

    val byteArrayOutputStream = ByteArrayOutputStream()
    val printParameters = "! 0 200 200 ${bitmapPreview.height} $quantity\r\n";
    byteArrayOutputStream.write(printParameters.toByteArray())
    val tone = "TONE 100\r\n"
    byteArrayOutputStream.write(tone.toByteArray())
    //val speed = "SPEED 2\r\n"
    //byteArrayOutputStream.write(speed.toByteArray())
    // val onFeed = "ON-FEED IGNORE\r\n"
    //byteArrayOutputStream.write(onFeed.toByteArray())
    //val pace = "NO-PACE\r\n"
    //byteArrayOutputStream.write(pace.toByteArray())
    val barSense = "GAP-SENSE\r\n"
    byteArrayOutputStream.write(barSense.toByteArray())


    byteArrayOutputStream.write("COMPRESSED-GRAPHICS".toByteArray())
    byteArrayOutputStream.write(ByteWidth.toString().toByteArray())
    byteArrayOutputStream.write(" ".toByteArray())
    byteArrayOutputStream.write(bitmapPreview.height.toString().toByteArray())
    byteArrayOutputStream.write(" ".toByteArray())
    byteArrayOutputStream.write(60.toString().toByteArray())
    byteArrayOutputStream.write(" ".toByteArray())
    byteArrayOutputStream.write(0.toString().toByteArray())
    byteArrayOutputStream.write(" ".toByteArray())
    printerConnection.write(byteArrayOutputStream.toByteArray())

    val var12 = PrinterConnectionOutputStream(printerConnection)
    val var13 = CompressedBitmapOutputStreamCpcl(var12)
    DitheredImageProvider.getDitheredImage(ZebraImageAndroid(bitmapPreview), var13)
    var13.close()
    var12.close()

    printerConnection.write("\r\n".toByteArray())


    val formCommand = "FORM\r\n"
    printerConnection.write(formCommand.toByteArray())
    val printCommand = "PRINT\r\n"
    printerConnection.write(printCommand.toByteArray())
}

private fun scaleImage(var1: Int, var2: Int, bitmap: Bitmap): Bitmap {
    return if (var1 > 0 && var2 > 0) {
        Bitmap.createScaledBitmap(bitmap, var1, var2, true)
    } else {
        bitmap
    }
}
CONTACT
Can’t find what you’re looking for?