Printing Barcodes using Variable Fields Cuts off first 3 Characters

// Expert user has replied.
B Ben Ray 2 years 9 months ago
168 4 0

Hi there,
We have implemented the Zebra SDK into our iOS and Android application and we are hitting an issue where the first 3 characters are getting cut off when printing out QR Code information using a variable field.
I have reached out to Zebra Support on this and they recommended that I come here. They do have this article but this resolution does not work when using variable fields Link (https://supportcommunity.zebra.com/s/article/QR-code-missing-first-three...)
In our scenario we are doing the following:
When using variable fields, you query the printer to get a list of the variable fields for a specific zpl file. All the data that comes back from that call is the field number (which zebra generates in the zpl file) and the field name (the name the label creator gives it, ie what you enter in the prompt text box). The sdk doesn’t give a way to determine if the variable field is for a text or for a barcode object. If it gave that (along with the barcode type) I could add the missing characters, but realistically, the sdk should add those characters when replacing actual data for a barcode variable field.
Has anyone experienced this and found a resolution on this. We did try this on Zebras printing app on the store and it has the same problem. So it sounds like this is a core problem with the SDK.
Thoughts?
Thanks in advance
-Ben

Please register or login to post a reply

4 Replies

B Ben Ray

We are not looking for a workaround here to this problem with the SDK. We have a much easier workaround now to just pad the data in our application with 3 dummy characters before the actual data. We would rather you acknowledge this as an issue in the SDK and put this into an updated SDK as this is much more difficult to implement into the application then just padding the first 3 characters.
We would appreciate it if you would acknowledge this is an issue in your SDK and look to patch it in a release. Is this is a possibility?
Thanks

S Steven Si

Hi Ben,
Thanks for sharing the finding. It looks like an issue to me too. This is because we need to pass the Switch Code to the template for the QR code encoding. This Switch Code is an extra characters in addition to the text to be encoded in the QR code. The only solution that I can come up with is to ask the people who creates the template to name the variable for QR code in the template with a special prefix or suffix, such as qr_xxxx or xxxx_qr. So that your application can differentiate the QR code variable from regular variables, then the application can attach the extra characters of Switch Code in front of the text that to be encoded by QR code.
Would this be a resonable workaround?
Regards,
Steven

B Ben Ray

Hi Alexander.
Below are the requested details:
Link OS sdk v. 2.14.5198
QLN420, Android 5-10
I think it's important to note that we are not in control of the zpl files or the printers. We require our clients specify what zpl file to print and we retrieve it from the printer they have chosen.
Below is the code
override suspend fun print(specs: ZebraPrintSpecs) {
connect()
val b = zebraPrinter?.retrieveFormatFromPrinter(specs.zplFile)
if (b != null) {
val zpl = String(b)
val formatData = zebraPrinter?.getVariableFields(zpl)
val imageMapper = ZebraImageMapper(specs.elementsOnPage, specs.dataDict, specs.imageInfoList)
val imageData = imageMapper.map()
if (imageData.isNotEmpty()) {
imageData.forEach {
zebraPrinter?.storeImage(it.first, it.second, it.second.width, it.second.height)
}
}
val dataMapper = ZebraDataMapper(specs.elementsOnPage, specs.dataDict, formatData)
val printData = dataMapper.map()
repeat(specs.quantity) {
zebraPrinter?.printStoredFormat(specs.zplFile, printData)
delay(500)
}
}
disconnect()
}
}
class ZebraDataMapper(private val elementsOnPage: List,
private val data: Map,
private val zebraMapping: Array?) : DataMapper {
override suspend fun map(): Map {
return withContext(Dispatchers.Default) {
val map = mutableMapOf()
if (zebraMapping != null) {
for (d in zebraMapping) {
val element: ZCElement? = elementsOnPage.find {
it.name == d.fieldName
}
element?.let {
map.put(d.fieldNumber, data[it.primaryKey].toString())
}
}
}
return@withContext map
}
}
}
Thanks!

A Alexander Palchikov

Hi Ben,
Could you please share the following details:

Which SDK version do you use? 
What printers do you use for testing? And which OS versions are there?
Can you please share the ZPL code that SDK sends to printers?
Can you please share a part of your code that creates labels?

 
Alexander Palchikov
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies

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