【问题标题】:How to direct print to a specific printer and not showing a print dialog?如何将打印定向到特定打印机而不显示打印对话框?
【发布时间】:2016-12-06 01:18:50
【问题描述】:

我有这个EDRAW LINK。我可以按照他的指南来浏览和打印 MS Word。但是在打印按钮中,我不想显示打印对话框,而是直接打印。我在谷歌搜索,但它给出了Print Document的例子

我使用了以下代码:

Private Sub btnPrint_Click(sender As System.Object, e As System.EventArgs) Handles btnPrint.Click
    AxEDOffice1.SetActivePrinter("Printer Name")
    AxEDOffice1.ActiveDocument.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4
    AxEDOffice1.PrintDialog()
End Sub

显示的是PrintDialog

【问题讨论】:

  • 始终提供您的代码!!
  • @Hadi 这是我按钮中的全部代码。
  • 我添加了它。您必须在每个问题中添加它。向其他用户展示您尝试过什么,否则您的问题将被否决且不会引起注意

标签: vb.net printing


【解决方案1】:

你必须使用PrintOut() 方法来实现这个:

AxEDOffice1.PrintOut(EDOfficeLib.WdPrintOutRange.wdPrintAllDocument)

【讨论】:

  • 这样的结果是导出一个XPS 文件。但不打印:(
  • @KiRa 您默认使用 xps 打印机。检查您提供的默认打印机名称
  • @KiRa 你的评论The result of this is exporting a XPS file 意味着你的问题得到了回答:)
猜你喜欢
  • 1970-01-01
  • 2019-06-18
  • 1970-01-01
  • 1970-01-01
  • 2018-11-11
  • 2013-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多