在编程打印期间摆脱打印机假脱机对话框
以下是我用于以编程方式打印 Word 文档的 CScript 脚本。
var err = 0;
var app = WScript.CreateObject("Word.Application");
try {
var filename = WScript.Arguments(0);
var enc = (filename.toLowerCase().indexOf(".txt") >= 0) || (filename.toLowerCase().indexOf(".htm")) ? 65001 : 1252;
var objDoc = app.Documents.Open(filename, false, true, false, " ", " ", false, " ", " ", 0, enc, true, false, 0, true);
objDoc.PrintOut(false, false, 0, "", "", "", 0);
} catch (e) {
err = 1;
} finally {
app.Quit(0);
}
WScript.Quit(err);
如何修改它以防止显示假脱机对话框? (这可能吗?)我所说的“假脱机对话框”的屏幕截图位于 http:// imgur.com/qqtib.png。
The following is the CScript script I use for the programmatic printing of a Word document.
var err = 0;
var app = WScript.CreateObject("Word.Application");
try {
var filename = WScript.Arguments(0);
var enc = (filename.toLowerCase().indexOf(".txt") >= 0) || (filename.toLowerCase().indexOf(".htm")) ? 65001 : 1252;
var objDoc = app.Documents.Open(filename, false, true, false, " ", " ", false, " ", " ", 0, enc, true, false, 0, true);
objDoc.PrintOut(false, false, 0, "", "", "", 0);
} catch (e) {
err = 1;
} finally {
app.Quit(0);
}
WScript.Quit(err);
How can I modify it to prevent the spooling dialog box from being displayed? (Is this even possible?) A screen capture of what I mean by "spooling dialog box" is at http://imgur.com/qqtib.png.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们曾经在尝试打印 Word 文档时做过类似的事情。我们现在使用 Aspose.Words for .NET 。效果很好。对打印有更多的控制,而不会出现加载单词的问题。
We used to do a very similar type of thing when trying to print Word documents. We now use Aspose.Words for .NET. It works great. Much more control over printing without the problems of loading word.