【发布时间】:2013-11-25 16:58:11
【问题描述】:
我在 ASP.NET MVC 项目中尝试了 MSDN 中的这个示例:
public void Print(string printQueueName, string printData)
{
PrintQueue printerQueue = new LocalPrintServer().GetPrintQueue(printQueueName);
// Call AddJob
PrintSystemJobInfo myPrintJob = printerQueue.AddJob();
// Write a Byte buffer to the JobStream and close the stream
Stream myStream = myPrintJob.JobStream;
Byte[] myByteBuffer = UnicodeEncoding.Unicode.GetBytes(printData);
myStream.Write(myByteBuffer, 0, myByteBuffer.Length);
myStream.Close();
}
我尝试打印到 PDF、XPS 和 OneNote 虚拟打印机。确认打印对话框后,打印作业出现在打印机队列中然后消失,并创建打印文件,但大小为 0 字节!!!
不知道自己的错在哪里,希望能在这里得到帮助。
提前致谢。
【问题讨论】:
标签: c# asp.net asp.net-mvc printing printqueue