Hello, I have a windows service with a tcp listener that receives order numbers and then retreives a report over a web service as an image... It can be anything... Png, Tiff, whatever. Anyways I get the image as a byte array.
I want to send that image to the printer in a nice easy elegant way. If I just send the byte array to the printer using sockets... I get nothing but garbage. I don't know really understand or know how printing works at anything more than the highest levels. Here is my code where I'm ready to print. The part where i was using sockets is commented out. I have another part there where I create an Image object from the byte array.
Please shed some light for me on a nice way to send this Image object or byte array to the printer. I don't think importing system.windows.forms and using a picturebox is a very elegant way to go about it though it'd probably be simplest.
If objBytes.Length > 0 Then
Dim objStream As New MemoryStream(objBytes)
Dim objImage As Image = Image.FromStream(objStream)
'objSocket = New Sockets.Socket(Sockets.AddressFamily.InterNetwork, Sockets.SocketType.Stream, Sockets.ProtocolType.Tcp)
'If objSocket.Connected Then
' objSocket.SendTo(objBytes, 0, objBytes.Length, Sockets.SocketFlags.None, objEndPoint)