
如果打印机中没有纸张,或者连接到POS的热敏打印机出现任何其它错误,我将尝试收到一条消息。有谁能帮我弄到这个吗。我正在获取如下所示的属性。
var server = new LocalPrintServer();
PrintQueue queue = server.DefaultPrintQueue;
//various properties of printQueue
var isOutOfPaper = queue.IsOutOfPaper;
var isOffLine = queue.IsOffline;
var isPaperJam = queue.IsPaperJammed;
var requiresUser = queue.NeedUserIntervention;
var hasPaperProblem = queue.HasPaperProblem;
var isBusy = queue.IsBusy;
if (isOutOfPaper.Equals("true"))
{
MessageBox.Show(isOutofPaper.ToString());
} 我想使用MessageBox显示一条消息,指出打印机已用完纸张。
看这里,它显示了默认的打印机名称

谢谢
发布于 2016-12-01 22:34:30
isOutOfPaper是一个布尔变量。将您的if语句更改为
if (isOutOfPaper)
{
MessageBox.Show(isOutofPaper.ToString());
} 备注
如果打印机不支持具有此含义的信号,则该属性始终为false。
更多信息:https://msdn.microsoft.com/en-us/library/system.printing.printqueue.isoutofpaper.aspx
https://stackoverflow.com/questions/40912828
复制相似问题