尝试从我的VB.NET应用程序打印到共享打印机时遇到问题。这是我的代码......
print1.PrinterSettings.PrinterName = "Printername"
print1.Print()
当我尝试运行它时,我收到此错误:
设置访问打印机"打印机名称"无效。
但是,如果我将此打印机设置为默认打印机,则可以正常工作。
如何使用VB.NET更改默认值?
答案 0 :(得分:0)
PrintDialog1.Document = PrintDocument1
PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
PrintDocument1.PrinterSettings.PrinterName = "Microsoft Print to PDF"
With PrintDocument1
.PrinterSettings.DefaultPageSettings.Landscape = False
.PrintController = New System.Drawing.Printing.StandardPrintController()
.Print()
End With