我正在嘗試編寫一個小型桌面應用程序,它只是坐下來打印下載的文件。VB.Net打印PDF失敗(但等同於PowerShell的作品)
發送PDF文件使用PowerShell打印機工作正常,它打印:
.\AcroRd32.exe /N /T C:\Path\to\201402124_label.pdf "Brother QL-700"
然而,做同樣的在Visual Studio 2012不起作用。 Adobe Reader窗口隨標籤打開並關閉,但文件從不在打印機上顯示。這是沒有意義的,因爲相同的代碼目前正致力於更大的PDF文件發送到相同的方式雙面打印機(只使用保存在My.Settings不同的打印機):
For Each file As IO.FileInfo In files
If file.CreationTime > My.Settings.LastRunDate Then
MsgBox(file.Name)
Dim startInfo As New ProcessStartInfo
Dim proc As Process = New Process
startInfo.WindowStyle = ProcessWindowStyle.Hidden
startInfo.Verb = "print"
startInfo.Arguments = My.Settings.LabelPrinterSettings.PrinterName.ToString
startInfo.UseShellExecute = True
startInfo.CreateNoWindow = True
startInfo.FileName = file.FullName
proc.StartInfo = startInfo
proc.Start()
proc.WaitForInputIdle()
proc.CloseMainWindow()
End If
Next
我想不通爲什麼通過CLI/PowerShell執行此操作,但不在VB.net內部
另外,請添加你所說的「不工作」的意思。 –