Text sometimes drops from the print

For some weird reason it is always the same part missing from the print:

Sometimes Hauler, Driver, Truck etc gets dropped from print.

But the QR code and barcode do not get dropped.

^XA^POI^MNV^LL2200^PW812^LL2300
^LH0,90^FD ^FS^LH0,140^FD ^FS^LH0,170
^FO25,0
^A0,N,25,25
^FDVic Forests - Docket #${weighedDocket.ticketNum}^FS
^LH0,200
^FO25,0^GB812,5,5,B,0^FS^LH0,250^FD ^FS^LH0,280
^FO25,0
^A0,N,25,25
^FD^BY3,3,70^BCN,70,N,N,N^FD${barcode}^FS^FS
^LH0,330^FD ^FS^LH0,380^FD ^FS^LH0,410
^FO25,0
^A0,N,25,25
^FD^FO210,0^FD${barcode}^FS^FS
^LH0,460^FD ^FS^LH0,490
^FO25,0
^A0,N,25,25
^FDDispatched:^FS
^LH0,490
^FO220,0
^A0,N,25,25
^FD${localTimes}^FS
^LH0,520
^FO25,0
^A0,N,25,25
^FDDestination:^FS
^LH0,520
^FO220,0
^A0,N,25,25
^FD${weighedDocket.destinationDesc}^FS
^LH0,570^FD ^FS^LH0,600
^FO25,0
^A0,N,25,25
^FDHarvest Unit:^FS
^LH0,600
^FO220,0
^A0,N,25,25
^FD${weighedDocket.locationDesc}^FS
^LH0,630
^FO25,0
^A0,N,25,25
^FDForest Ops:^FS
^LH0,630
^FO220,0
^A0,N,25,25
^FD${weighedDocket.contractDesc}^FS
^LH0,660
^FO25,0
^A0,N,25,25
^FDContractor:^FS
^LH0,660
^FO220,0
^A0,N,25,25
^FD${weighedDocket.harvestDesc}^FS
^LH0,710^FD ^FS^LH0,740
^FO25,0
^A0,N,25,25
^FDHauler:^FS
^LH0,740
^FO220,0
^A0,N,25,25
^FD${weighedDocket.haulContractorDesc}^FS
^LH0,770
^FO25,0
^A0,N,25,25
^FDDriver:^FS
^LH0,770
^FO220,0
^A0,N,25,25
^FD${weighedDocket.driverName}^FS
^LH0,800
^FO25,0
^A0,N,25,25
^FDTruck Reg:^FS
^LH0,800
^FO220,0
^A0,N,25,25
^FD${weighedDocket.truckDesc}^FS
^LH0,830
^FO25,0
^A0,N,25,25
^FDTrailer Type:^FS
^LH0,830
^FO220,0
^A0,N,25,25
^FD${weighedDocket.trailerType}^FS
^LH0,860
^FO25,0
^A0,N,25,25
^FDLoaded by: ^FS
^LH0,860
^FO220,0
^A0,N,25,25
^FD${weighedDocket.truckLoaderDesc || ''}^FS
^LH0,910^FD ^FS^LH0,940
^FO25,0
^A0,N,25,25
^FDLegal GVM:^FS
^LH0,940
^FO220,0
^A0,N,25,25
^FD${totalLegalGVM} (ton)^FS
^LH0,970
^FO25,0
^A0,N,25,25
^FDScale Weight:^FS
^LH0,970
^FO220,0
^A0,N,25,25
^FD${truckWeightWithLoad} (ton)^FS
^LH0,1010
^FO25,0^GB812,5,5,B,0^FS^LH0,990
^LH0,1020^FD ^FS^LH0,1050
^FO25,0
^A0,N,25,25
^FDSpecies:^FS
^LH0,1050
^FO220,0
^A0,N,25,25
^FD${weighedDocket.productCodeDesc}^FS
^LH0,1080
^FO25,0
^A0,N,25,25
^FDGrade:^FS
^LH0,1080
^FO220,0
^A0,N,25,25
^FD${weighedDocket.productGradeCode}^FS
^LH0,1110
^FO25,0
^A0,N,25,25
^FDNight Load:^FS
^LH0,1110
^FO220,0
^A0,N,25,25
^FD${nightLoad}^FS
^LH0,1140
^FO25,0
^A0,N,25,25
^FDTransit Load:^FS
^LH0,1140
^FO220,0
^A0,N,25,25
^FD${transitLoad}^FS
^LH0,1190^FD ^FS^LH0,1220
^FO25,0
^A0,N,25,25
^FD100% AFS certified^FS
^LH0,1250
^FO25,0
^A0,N,25,25
^FDCertification Number: AFS 703072^FS
^LH0,1350
^A0,N,25,25
^FO25,0
^IME:IMAGE.PNG^FS
^LH0,1580
^FO25,0
^A0,N,25,25
^FDI certify this delivery complies with mass limits^FS
^LH0,1610
^FO25,0
^A0,N,25,25
^FDprescribed by Heavy Vehicle National Law (HVNL)^FS
^LH0,1640
^FO25,0^GB812,5,5,B,0^FS^LH0,1620
^FO25,0
^A0,N,25,25
^LH0,1650^FD ^FS^LH0,1670
^FO25,0
^A0,N,25,25
^FD^BY3,3,70^BCN,70,N,N,N^FD${barcode}^FS^FS
^LH0,1720^FD ^FS^LH0,1830^FD ^FS^LH0,1760
^FO25,0
^A0,N,25,25
^FD^FO210,0^FD${barcode}^FS^FS
^LH0,1820^FD ^FS^LH0,1910^FD ^FS^LH0,1850
^FO25,0^BXN,4,200,,,,\,^FH^FD${compressedDocket}^FS^LH0,1900^FD ^FS^LH0,1930
^XZ^

byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);

// Instantiate insecure connection for given Bluetooth® MAC Address.
Connection conn = new BluetoothConnectionInsecure(theBtMacAddress);

// Initialize
Looper.prepare();

// Open the connection - physical connection is established here.
conn.open();

ZebraPrinter zprinter = ZebraPrinterFactory.getInstance(conn);

ZebraImageI zi = ZebraImageFactory.getImage(bitmap);

zprinter.storeImage("E:IMAGE.PNG", zi, zi.getWidth(), zi.getHeight());

Thread.sleep(500);

// Send the data to printer as a byte array.
conn.write(zplData.getBytes());

// Make sure the data got to the printer before closing the connection
Thread.sleep(500);

// Close the insecure connection to release resources.
conn.close();

Looper.myLooper().quit();

Steven Si
Does this happen all the time

Does this happen all the time? If it happens all the time, then you need to take a look at the ZPL.

What tool do you use to generate the ZPL? There are a lot ^LH commands and ^FD ^FS commands without field values. We only need to use the ^LH once in one ZPL label format. Once we have the label origin is defined at the beginning by ^LH, we only need to use ^FO to specify the field origin for each elements on the label that are relative to ^LH.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Thomas Birkenes
It happens often the first time when printing

It happens usually at the first print. But when you print it a second time it is working.

The tool i use to generate the zpl is just saving it as a string. So the string that I used above is changed to the one below. Removing the additional LH and FD and FS as you suggested. Hopefully it solved the issue.

^XA^POI^MNV^LL2200^PW812^LL2300
^LH0,170
^FO25,0
^A0,N,25,25
^FDVic Forests - Docket #${weighedDocket.ticketNum}^FS
^FO25,30^GB812,5,5,B,0
^A0,N,25,25
^FO25,60
^FD^BY3,3,70^BCN,70,N,N,N^FD${barcode}^FS^FS
^FD^FO190,180 ^A0,N,25,25^FD${barcode}^FS^FS
^FO25,280
^A0,N,25,25
^FDDispatched:^FS
^FO220,280
^A0,N,25,25
^FD${localTimes}^FS
^FO25,310
^A0,N,25,25
^FDDestination:^FS
^FO220,310
^A0,N,25,25
^FD${weighedDocket.destinationDesc}^FS
^FO25,380
^A0,N,25,25
^FDHarvest Unit:^FS
^FO220,380
^A0,N,25,25
^FD${weighedDocket.locationDesc}^FS
^FO25,410
^A0,N,25,25
^FDForest Ops:^FS
^FO220,410
^A0,N,25,25
^FD${weighedDocket.contractDesc}^FS
^FO25,440
^A0,N,25,25
^FDContractor:^FS
^FO220,440
^A0,N,25,25
^FD${weighedDocket.harvestDesc}^FS

^FO25,500
^A0,N,25,25
^FDHauler:^FS
^FO220,500
^A0,N,25,25
^FD${weighedDocket.haulContractorDesc}^FS
^FO25,530
^A0,N,25,25
^FDDriver:^FS
^FO220,530
^A0,N,25,25
^FD${weighedDocket.driverName}^FS
^FO25,560
^A0,N,25,25
^FDTruck Reg:^FS
^FO220,560
^A0,N,25,25
^FD${weighedDocket.truckDesc}^FS
^FO25,590
^A0,N,25,25
^FDTrailer Type:^FS
^FO220,590
^A0,N,25,25
^FD${weighedDocket.trailerType}^FS
^FO25,620
^A0,N,25,25
^FDLoaded by: ^FS
^FO220,620
^A0,N,25,25
^FD${weighedDocket.truckLoaderDesc || ''}^FS

^FO25,680
^A0,N,25,25
^FDLegal GVM:^FS
^FO220,680
^A0,N,25,25
^FD${totalLegalGVM} (ton)^FS
^FO25,710
^A0,N,25,25
^FDScale Weight:^FS
^FO220,710
^A0,N,25,25
^FD${truckWeightWithLoad} (ton)^FS

^FO25,750^GB812,5,5,B,0

^FO25,780
^A0,N,25,25
^FDSpecies:^FS
^FO220,780
^A0,N,25,25
^FD${weighedDocket.productCodeDesc}^FS
^FO25,810
^A0,N,25,25
^FDGrade:^FS
^FO220,810
^A0,N,25,25
^FD${weighedDocket.productGradeCode}^FS
^FO25,840
^A0,N,25,25
^FDNight Load:^FS
^FO220,840
^A0,N,25,25
^FD${nightLoad}^FS
^FO25,870
^A0,N,25,25
^FDTransit Load:^FS
^FO220,870
^A0,N,25,25
^FD${transitLoad}^FS

^FO25,920
^A0,N,25,25
^FD100% AFS certified^FS
^FO25,950
^A0,N,25,25
^FDCertification Number: AFS 703072^FS
^FO25,1050
^A0,N,25,25
^IME:IMAGE.PNG^FS

^FO25,1300
^A0,N,25,25
^FDI certify this delivery complies with mass limits^FS
^FO25,1330
^A0,N,25,25
^FDprescribed by Heavy Vehicle National Law (HVNL)^FS

^FO25,1370^GB812,5,5,B,0

^FO25,1400
^A0,N,25,25
^FD^BY3,3,70^BCN,70,N,N,N^FD${barcode}^FS^FS
^FD^FO190,1520 ^A0,N,25,25^FD${barcode}^FS^FS

^FO25,1600^BXN,4,200,,,,\,^FH^FD${compressedDocket}^FS
^XZ^

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Steven Si
Looks like the above ZPL

Looks like the above ZPL format is used as a self-defined template, since the statements of ${..}, such as ^FD${barcode}^FS, are not standard format for variables. In standard ZPL template, it uses ^FN command for variables. Since it's a self-defined template, your application will be responsible for replacing these ${...} variables with proper values.

There are a few minor issues in the above ZPL. The ^XZ^ at the end should be just ^XZ. There are 4 places where ^FS^FS is used instead of a single ^FS for the end of the field.

I've tried with the above ZPL by directly sending it to a printer via Printer Setup Utility tool for Windows. I didn't see anything missing. So the ZPL seems fine. Just make sure that the replacement of variables for values is done properly in the application.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Thomas Birkenes
Thank you

Thank you. It is working nicely. I will update if I see any other issues happening.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments