Skip to content

sendBinary

Description

Sends binary data to the printer without any conversion.
By sending printer commands as raw binary data, functions that are not supported by the library can also be used.
However, commands that require a response from the printer are not supported by this method.

Syntax

public func sendBinary(_ data: Data) async throws

Parameter

data

Specify the binary data as a byte array.
The maximum data size that can be sent at one time is 3 MB (3,145,728 bytes).

Sample

    let bytes: [UInt8] = [0x0C]
    let data = Data(bytes)

    do {
        try await printerManager.sendBinary(data)
    } catch {
        print(error)
    }