Page 1 of 1

2019 SDK IPrinter.SendDataToPrinter What format is Data byte[]?

Posted: Mon Nov 28, 2022 6:00 pm
by shawnWork
Question: What format/encoding should be the data byte[]?
- Base64, Ascii, etc.?

Information copied below from Nice Label SDK Help File.

Printer.SendDataToPrinter Method NiceLabel SDK.NET

Sends the data to printer by creating a new print job and sending it to the spooler.

Namespace: NiceLabel.SDK
Assembly: SDK.NET.Interface (in SDK.NET.Interface.dll) Version: (

C#VBC++F#Copyvoid SendDataToPrinter(
byte[] data
Sub SendDataToPrinter (
data As Byte()
void SendDataToPrinter(
array<unsigned char>^ data
abstract SendDataToPrinter :
data : byte[] -> unit

Type: System.Byte[]
The data for the print job.
See Also

IPrinter Interface
NiceLabel.SDK Namespace

Re: 2019 SDK IPrinter.SendDataToPrinter What format is Data byte[]?

Posted: Wed Dec 07, 2022 12:29 am
by Mytch

Your "data" byte[] array should contain content that is encoded in a format which is understood by the destination printer (varies by PCL). This content contains the raw print commands which you will send to the hardware. There is no requirement from NiceLabel perspective, I would say UTF-8 is preferred over ASCII since I cannot see the benefit of the inverse.

The most common use-case is just reading an existing file to byte array then sending that directly to the printer, so it often just comes down to the format of existing content.

Simple example sending ASCII test to Zebra printer:
2022-12-06_16h30_26.png (53.42 KiB) Viewed 67 times
You can see we have sent 4 bytes of data to the printer, but in practice this should contain real ZPL commands for this printer.