Windows 8のエプソンの一部の製品を除くすべてのプリンターで正常に動作する印刷機能を備えたアプリケーションがあります。問題を再現する最小限のサンプルを作成することができました。次のメソッドを呼び出して、正しい xps ファイルへのフル パスを指定します。
private void Print(string xpsFilename)
{
if (string.IsNullOrEmpty(xpsFilename))
{
return;
}
PrintDialog printDialog = new PrintDialog();
printDialog.ShowDialog();
PrintQueue defaultPrintQueue = printDialog.PrintQueue;
try
{
// This is were it seems to fail for some Epson printers: no job in spooler, no print ...
PrintSystemJobInfo xpsPrintJob = defaultPrintQueue.AddJob("Print through 'AddJob' on PrintQueue", xpsFilename, false);
}
catch (PrintJobException printJobException)
{
Console.WriteLine("{0} Could not be added to the print queue.", xpsFilename);
Console.WriteLine(printJobException.Message);
}
catch (Exception exception)
{
Console.WriteLine("{0} Unknown error:", xpsFilename);
Console.WriteLine(exception.Message);
}
}
Epson プリンタを選択すると、スプーラにジョブが表示されませんが、他のプリンタでは動作することがわかります。
印刷されていない理由を知っている人はいますか (ジョブはスプールにも表示されません)。実際のアプリケーションでは、xps ファイルを使用せずにページネーターを使用しますが、サンプルの目的では、より単純で失敗します ...
助けてくれてありがとう。