【问题标题】:Closing the AutomationFactory Object关闭 AutomationFactory 对象
【发布时间】:2013-11-25 09:08:30
【问题描述】:

我们目前启动 adobe reader 以从我们的旧版 silverlight 产品中打印出 pdf,该产品适用于以下代码:

Dim shell = AutomationFactory.CreateObject("Shell.Application")
shell.ShellExecute(path, "", "", "print", 1)

这很好用,问题是打印完成后 Adob​​e 阅读器应用程序仍然处于打开状态,这对用户群来说有点烦人。

我的问题是我们如何从代码中关闭 adobe reader 应用程序?

谢谢

【问题讨论】:

  • Herethere 他们说它只能被杀死。
  • 通过使用 /n /p 它将打开一个新的阅读器,如果它不是最后一个,它将关闭它。您可以计算打开的实例数,如果没有实例,则在最后将其杀死。如果已经有一个实例,那么您不需要杀死它(/n /p 将负责关闭它)。

标签: vb.net silverlight pdf acrobat


【解决方案1】:

你不能。 您调用 Adob​​e Reader 和另一个进程,打开另一个程序。除了终止任务,您无能为力了。

但终止任务的问题在于,您可能会关闭在新的 Adob​​e Reader 实例中打开打印文件后打开的另一个 PDF 文件。

如果您选择终止 Adob​​e 进程,我认为这在自定义软件或封闭且已知的用户环境中是可以的。但是应该警告用户这种行为。通过软件手册或用户培训。

【讨论】:

    【解决方案2】:

    我用它来发送一个 pdf 到标准打印机

            Dim pd As New System.Drawing.Printing.PrintDocument
    
            Dim p As New PrintDialog()
            p.SelectedPagesEnabled = False
    
            If p.ShowDialog() = True Then
    
                pd.DocumentName = pdfFile
                pd.PrinterSettings.PrinterName = p.PrintQueue.Name
                pd.PrintController = New System.Drawing.Printing.StandardPrintController()
                pd.OriginAtMargins = False
                pd.Print()
    
            End If
    

    也许你也适合你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-04
      • 2011-12-21
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      • 2014-06-06
      • 2015-06-13
      相关资源
      最近更新 更多