在编程打印期间摆脱打印机假脱机对话框

发布于 2024-09-10 17:01:49 字数 694 浏览 4 评论 0原文

以下是我用于以编程方式打印 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昔日梦未散 2024-09-17 17:01:49

我们曾经在尝试打印 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文