我正在尝试发送要打印的文件,而无需按照此处的几个答案的建议通过 Adobe 打开它;相反,我正在使用PrintQueue
库(来自System.Drawing.Printing
)。
到目前为止我已经完成了什么:
我有正确的PrintQueue
引用为 pq:
PrintQueue pq; //Assume it's correct. The way to get here it isn't easy and it is not needed for the question.
// Call AddJob
PrintSystemJobInfo myPrintJob = pq.AddJob();
// Write a Byte buffer to the JobStream and close the stream
Stream myStream = myPrintJob.JobStream;
Byte[] myByteBuffer = ObjectIHave.ToArray(); //Ignore the ObjectIhave, it actually is Linq object which is correct as well.
myStream.Write(myByteBuffer, 0, myByteBuffer.Length);
myStream.Close();
正如我从 Microsoft库中了解到的那样,它已正确完成,但无法正常工作。有任何想法吗?
编辑:调试代码我可以看到某些东西正在发送到打印机,但似乎没有发送文件。