Process.StartInfo = starter Process.Start()
Process.StartInfo = starter Process.Start()
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
Process.StartInfo = starter Process.Start()
Dim printers As System.Drawing.Printing.PrinterSettings.StringCollection printers = System.Drawing.Printing.PrinterSettings.InstalledPrinters() For x As Integer = 0 To printers.Count - 1 liste_imprimante.Items.Add(printers(x)) Next
Sub impression(ByVal pathFile As String) Dim Prt_Proc As New Process ' imprime selon l'extension Try Prt_Proc.StartInfo.FileName = pathFile ' Selon type de fichier (print OU printTo) 'Prt_Proc.StartInfo.Verb = "PrintTo" Prt_Proc.StartInfo.Verb = "Print" Prt_Proc.StartInfo.CreateNoWindow = True Prt_Proc.StartInfo.Arguments = "nom_imprimante" Prt_Proc.StartInfo.UseShellExecute = True Prt_Proc.Start() Prt_Proc.WaitForExit() Prt_Proc.Dispose() Catch ex As Exception Prt_Proc.Dispose() End Try