我正在使用虚拟打印机将 word 文档打印到 C# 程序中的图像文件中。到目前为止一切都很好,只是我不知道打印过程何时完成,所以我可以读取生成图像的内容。这是我的代码:
using System;
using Microsoft.Office.Interop.Word;
using Word=Microsoft.Office.Interop.Word;
var app = new ApplicationClass();
object filename = "C:\\ad.doc";
var missing = Type.Missing;
var doc = app.Documents.Open(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
var oldPrinter = app.ActivePrinter;
app.ActivePrinter = "Name of printer";
object outputFileName = "c:\\ad.tif";
object trueValue = true;
object falseValue = false;
doc.PrintOut(ref trueValue, ref falseValue, ref missing, ref outputFileName, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref trueValue, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
app.ActivePrinter=oldPrinter ;
doc.Close(ref missing, ref missing, ref missing);
app.Quit(ref missing, ref missing, ref missing);
那么如何确定打印处理完成,以便继续获取图像内容呢?