0

私は ESC-POS 印刷システムで作業しています。以下のコードを使用してメッセージを印刷できますが、テキスト全体が印刷されません。

NSMutableData* commandData = [[NSMutableData alloc] init];
[commandData appendBytes:"ESC" "@" length:0];
[commandData appendBytes:"ESC" "!" "0" length:0];
[commandData appendBytes:"ESC" "d" "20" length:0];

NSString *text = @"\nUnderline exceptions\n- Does not underline 90°/270° rotation\n- Does not underline horizontal tabs\n- Underline thickness";
NSData* data = [text dataUsingEncoding:NSUTF8StringEncoding];
[commandData appendData:data];

NSString *text1 = @"\nThis command resets the left and right margins\n- Left margin set by :ref:`Left Margin<1d4c>`\n- Right margin set by :ref:`Print Area Width<1d57>`\nFor each of the underline, italic, bold modes:\n- These can be issued by their respective ESC commands or this command\n- The last received command is the effective command.;\nThis command resets the left and right margins\n- Left margin set by :ref:`Left Margin<1d4c>`\n- Right margin set by :ref:`Print Area Width<1d57>`\nFor each of the underline, italic, bold modes:\n- These can be issued by their respective ESC commands or this command\n- The last received command is the effective command.;";
NSData* data1 = [text1 dataUsingEncoding:NSUTF8StringEncoding];
[commandData appendData:data1];

const void* sendBuffer = (unsigned char*)[commandData bytes];
NSUInteger sendLength =commandData.length;

if(sendLength==7){
    sendLength=7;//for Test
}

if (self.discoveredCharacteristic != nil){
    [self.discoveredPeripheral writeValue:[NSData dataWithBytes:sendBuffer length:sendLength] forCharacteristic:self.discoveredCharacteristic type:CBCharacteristicWriteWithResponse];
}

私が間違いをしている場所を教えてください。

前もって感謝します。

4

0 に答える 0