Here is the solution of printing PDF file by giving printer name
Dim pathToExecutable As String = “AcroRd32.exe”
Dim sReport = “C:Test.PDF” ‘Complete name/path of PDF file
Dim SPrinter = “HP Officejet 5600 seriese” ‘Name Of printer
Dim starter As New ProcessStartInfo(pathToExecutable, “/t “ + sReport + ” “ + sPrinter + “”)
Dim Process As New Process()
Process.StartInfo = starter Process.Start()
‘try and close the process with 20 seconds delay
System.Threading.Thread.Sleep(30000)
Process.CloseMainWindow()
Dim iLoop As Int16 = 0
‘check the process has exited or not
If Process.HasExited = False Then
‘if not then loop for 100 time to try and close the process‘with 10 seconds delay
While Not Process.HasExited
System.Threading.Thread.Sleep(10000)
Process.CloseMainWindow()
iLoop = CShort(iLoop + 1)
If iLoop >= 100 Then
Exit While
End If
End While
End If
Process.Close()
Process.Dispose()
Process = Nothing
starter = Nothing
Any questions or suggestion regarding to this feel free to write.
Enjoy it.