[英]How to print PDF with Not default printer with code (VB Net)
我正在尝试打印pdf文件,使用默认打印机打印是没有问题的,但是当我想使用第二台打印机进行打印时,它仍然使用默认打印机打印。
这是我的代码:
Dim MyProcess As New Process
MyProcess.StartInfo.CreateNoWindow = False
MyProcess.StartInfo.Verb = "print"
'HERE IS WHERE I WANT TO CHANGE THE PRINTER (BUT THIS COMMAND IS IGNORED)
MyProcess.StartInfo.Arguments = "Canon MG3500 series"
MyProcess.StartInfo.UseShellExecute = True
MyProcess.StartInfo.FileName = My.Application.Info.DirectoryPath & "\Copias digitales\Temp.pdf"
MyProcess.Start()
MyProcess.WaitForExit(10000)
MyProcess.CloseMainWindow()
MyProcess.Close()
我该怎么做?
谢谢你们。
使用打印机Settings.Printername命名空间下System.Drawing.Printing
然后指定打印机的名称(“ Canon MG3500 series”)
PrinterSettings控件用于通过指定打印机来配置文档的打印方式。 资源
这应该做。
注意:这还允许您使用打印机上的已应用设置(
i.e. Paper size
我每次需要使用两台打印机时都使用此功能
ie one for the OR then another for a document
我发现解决方案用以下方法替换了坏行:
Shell(String.Format("rundll32 printui.dll,PrintUIEntry /y /n ""{0}""", "Printer name"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.