元の印刷テキストの後に余分なテキスト行を配置する必要があるアプリケーションに取り組んでいます。
このために、正常に動作する Print Spooler API の FindFirstPrinterChangeNotification および FindNextPrinterChangeNotification メソッドを使用しています。
ジョブカウント1を示すPrint Queueを取得できました。
次のコードを使用して、印刷キューに新しいジョブを追加しています。
// Create the printer server and print queue objects
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue();
// Call AddJob
PrintSystemJobInfo myPrintJob = defaultPrintQueue.AddJob();
// Write a Byte buffer to the JobStream and close the stream
Stream myStream = myPrintJob.JobStream;
Byte[] myByteBuffer = UnicodeEncoding.Unicode.GetBytes("This is a test string for the print job stream.");
myStream.Write(myByteBuffer, 0, myByteBuffer.Length);
myStream.Close();
私のコードは例外なく正常に実行されますが、新しいジョブは元のテキストと一緒に印刷されません。