I need to be able to receive a byte array from a user and send that data on to a printer.
This sounds simple but it is not turning out that way.
byte[] bytes = File.ReadAllBytes(@"AppServer\Test_doc.txt");
string fileName = "Test_doc.txt";
PrintServer printServer = new PrintServer(@"\\PRINTERserver1");
PrintQueue printQueue = printServer.GetPrintQueue("PRINTERname");
PrintSystemJobInfo thisJob = printQueue.AddJob(fileName);
Stream myStream = thisJob.JobStream;
myStream.Write(bytes, 0, bytes.Length);
myStream.Close();
I see examples that claim this works but it does not. I can see the document SPOOLING in the printer queue window but nothing ever comes out.
The printServer and printQueue objects are initializing correctly. When I look at their properties I see things that would not be there if a connection is not being made.
Any help would appreciated.