I'm looking for a better way to print pdf documents from a vb 2010 app. I have tried 2 techniques that work, but both have some minor issues that I'd like to address. The 1st technique uses command line arguments as follows:
Code:
Dim starterStr As String = "/h /t " & Chr(34) & pdfFileName & Chr(34) & " " & Chr(34) & printerName & Chr(34)
Dim starter As New ProcessStartInfo("AcroRd32.exe", starterStr)
Dim print As New Process()
With print
.StartInfo = starter
.Start()
.Close()
End With
But this approach leaves the Acrobat process still running after completion, so users need to manually close the window.
A 2nd technique that also works is one that sets the Process StartInfo arguments:
Code:
Dim print As New Process()
With print
.StartInfo.CreateNoWindow = True
.StartInfo.Verb = "print"
.StartInfo.FileName = pdfFileName
.Start()
.Close()
End With
The 2nd technique is more aesthetically pleasing to me, but has the same annoying problem of leaving the Acrobat process running after execution. It also doesn't allow me to set the output printer destination (the above code sends the output to the default printer).
Any suggestions on:
1. how to close the Acrobat process
2. how to set an output printer destination using StartInfo arguments
3. a better technique that I haven't thought of