2019 SDK IPrinter.SendDataToPrinter What format is Data byte[]?
Moderator: NiceLabel Support Team
2019 SDK IPrinter.SendDataToPrinter What format is Data byte[]?
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: 17.2.0.0 (19.2.1.5400)
Syntax
--------------------------------------------------------------------------------
C#VBC++F#Copyvoid SendDataToPrinter(
byte[] data
)
Sub SendDataToPrinter (
data As Byte()
)
void SendDataToPrinter(
array<unsigned char>^ data
)
abstract SendDataToPrinter :
data : byte[] -> unit
Parameters
data
Type: System.Byte[]
The data for the print job.
See Also
--------------------------------------------------------------------------------
Reference
IPrinter Interface
NiceLabel.SDK Namespace
- 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: 17.2.0.0 (19.2.1.5400)
Syntax
--------------------------------------------------------------------------------
C#VBC++F#Copyvoid SendDataToPrinter(
byte[] data
)
Sub SendDataToPrinter (
data As Byte()
)
void SendDataToPrinter(
array<unsigned char>^ data
)
abstract SendDataToPrinter :
data : byte[] -> unit
Parameters
data
Type: System.Byte[]
The data for the print job.
See Also
--------------------------------------------------------------------------------
Reference
IPrinter Interface
NiceLabel.SDK Namespace
- Mytch
- NiceLabel Support
- Posts: 325
- Joined: Fri Jul 13, 2018 10:26 pm
- Location: Milwaukee, Wisconsin
- Contact:
Re: 2019 SDK IPrinter.SendDataToPrinter What format is Data byte[]?
Hi,
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: 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.
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: 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.
Mytch
www.loftware.com

