Sato Printers if ethernet based can just use a ASCII string sent to it through IP and PORT(9100). Example of code below:
public static bool SendPrintJob(string sendString, string ipAddress, int port)
{
bool bReturn = true;
sendString.ThrowIfNullOrEmpty("sendString");
ipAddress.ThrowIfNullOrEmpty("ipAddress");
if (port <= 0)
port = 9100;
Socket sock = null;
try
{
IPEndPoint remoteIP = new IPEndPoint(IPAddress.Parse(ipAddress), port);
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IAsyncResult results = sock.BeginConnect(remoteIP, null, null);
bool success = results.AsyncWaitHandle.WaitOne(5000, true);
if (!sock.Connected)
{
bReturn = false;
Log.WriteToErrorLog("Error in socket connection: Could not connect to printer.", "", "Socket Error: SendPrintJob");
}
else
{
byte[] sendData = Encoding.ASCII.GetBytes(sendString);
int result = sock.Send(sendData, sendData.Length, 0);
if (result == 0)
{
bReturn = false;
Log.WriteToErrorLog("Error in socket transmission: Could not send data to printer.", "", "Socket Error: SendPrintJob");
}
}
return bReturn;
}
finally
{
if (sock != null)
sock.Close();
}
}