Printing stability

D Dmitrij Burakov,30g78uf68ae0aa4wrzb4rc6em1jumq6q 3 years 7 months ago
13 1 0

Hi,
 
I have a problem with printing stability using QLn 320 Zebra with firmware V68.19.7Z from iOS application.
I use Zebra SDK and print code is:
 
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {
        // Instantiate connection to Zebra Bluetooth accessory
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        NSString *serialNumber = [defaults valueForKey:@"selectedPrinterSN"];
        id thePrinterConn = [[MfiBtPrinterConnectionalloc] initWithSerialNumber:serialNumber];
       
        BOOL success = [thePrinterConn open];
       
        NSString *zplData = [NSString stringWithFormat:
                             @"^XA" \
                             @"^LH20,20^POI" \
                             @"^FT5,5^FH^A0N,30,30^FD%@^FS" \
                             @"^FT5,45^FH^A0N,30,30^FD%@^FS" \
                             @"^XZ" \
                             , @“Line1”, @“Line2”];
       
        NSError *error = nil;
        NSMutableData *data = [[zplData dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];       
       
        long blockSize = 1024;
        long totalSize = data.length;
        long bytesRemaining = totalSize;
        while (bytesRemaining > 0) {
            long bytesToSend = MIN(blockSize, bytesRemaining);
            NSRange range = NSMakeRange(0, bytesToSend);
           
            NSData *partialLabel = [data subdataWithRange:range];
            [thePrinterConn write:partialLabel error:&error];
           
            bytesRemaining -= bytesToSend;
           
            [data replaceBytesInRange:range withBytes:NULL length:0];
            if (error) {
                break;
            }
        }
 
        [thePrinterConn close];
       
        dispatch_async(dispatch_get_main_queue(), ^{
              //Update UI on the main queue!
        });
    });
 
There is a button “Print Label” on UI that triggers label printing.
Sometimes label is not printed (about 1 label of 10 attempts) without any errors from MfiBtPrinterConnection.
I tried to change timeout but this didn’t help.
[((MfiBtPrinterConnection*)thePrinterConn) setTimeToWaitAfterWriteInMilliseconds:30];
 
Could you advice how to find the reason of that (get logs from printer or something different)?

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

Hello Dmitrij,

The data that you are trying to print, is it all text or is there images in it? If it is just text is there alot of text? Depending on what you are sending down to print you may need to make the timeout higher than 30.

Also, you are using V68.19.7Z firmware which is no longer the latest firmware, please download the latest firmware here and see if the issue persists.

Thank you,
Beverly

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