Announcements
I'm printing a barcode to a Printronix printer, using zpl code. The code is 17 characters long and it results in barcode which is too wide. Label designers optimizes these barcodes by deviding them into subsets of type A, B or C. This results in a smaller barcode. Has anyone a generic algorithm in x++ for this problem?
*This post is locked for comments
Great. Thanks for sharing.
Hi,
A senior developer looked into this. The ZPL engine on the printer (an open source library commonly used) does not do the job nicely like a program like NiceLabel, Zebra Designer or Bartender.
We now hardcoded the format since we know the pattern of our serial numbers. However, we prefer to have it coded in such a way that our pattern does not matter.
J.
==
public void printFromInventSerial(InventSerial _inventSerial) { str inventSerialId; computerName = Microsoft.Dynamics.AX.WHS.DeviceCom.ClientHelper::RetrieveClientName(); worker = currentWorker(); select firstOnly1 barCodeSetupId from barCodeSetup where barCodeSetup.barcodeType == BarcodeType::EAN13; barCodeSetupId = barCodeSetup.barcodeSetupId; //Find record in Document Routing for selection of correct printer/layout select firstOnly1 routingTable where routingTable.WorkTransType == WHSWorkTransType::ProdPut && (!routingTable.ComputerName || routingTable.ComputerName == computerName) && (!routingTable.Worker || routingTable.Worker == worker); select firstOnly1 inventItemBarcode where inventItemBarcode.itemId == _inventSerial.ItemId && inventItemBarcode.barcodeSetupId == barCodeSetupId; inventSerialId = _inventSerial.InventSerialId; inventSerialId = strReplace(inventSerialId, 'SN-', 'SN->5'); inventSerialId = strReplace(inventSerialId, '-0', '>6->50'); //above should not be hardcoded if (!inventItemBarcode.itemBarCode) { info(strFmt("@MCR39604",_inventSerial.ItemId, "@SYS63146"+'\"')); } //Only if routingTable record found, print for all the document routing lines if (routingTable && inventItemBarcode.itemBarCode) { while select LayoutId, PrinterName from routingLine where routingLine.DocumentRoutingTable == routingTable.RecId { layoutstr = WHSDocumentRoutingLayout::find(routingLine.LayoutId).zpl; finalstr = strReplace(layoutstr, '$ItemId$', strFmt("%1",_inventSerial.ItemId)); finalstr = strReplace(finalstr, '$InventSerialId$', strFmt("%1",inventSerialId)); finalstr = strReplace(finalStr, '$EAN13$', strFmt("%1",inventItemBarcode.itemBarCode)); Microsoft.Dynamics.AX.WHS.DeviceCom.Printer::SendStringToPrinter(routingLine.PrinterName, finalStr); } } }
I believe you might want to talk to a developer to make this. I don't know any standard method that would support splitting up ute barcodes.
But can't you just let ZPL divide the format for you?
I am wondering if there is anybody out there for a solution?
André Arnaud de Cal...
294,033
Super User 2025 Season 1
Martin Dráb
232,854
Most Valuable Professional
nmaenpaa
101,158
Moderator