Click here to Skip to main content
15,846,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to print all the images in a folder by using Processstartinfo.verb="print" command

i have the code to print single image like this
dim psinfo as new processstartinfo

but i want to print more images at a time by using this command. in Folder if i select all images(Ctrl+A) and then RightClick and then print. then this is working fine and printing all images. in the same way i want to print images using if Anyone know how to do this please reply....
Updated 16-Oct-18 3:31am

1 solution

check below code

For Each file In IO.Directory.GetFiles(folderPath)
        Dim psi As New ProcessStartInfo(file )
        If psi.Verbs.Contains("print") Then
            psi.Verb = "print"
            psi.UseShellExecute = True
            psi.WindowStyle = ProcessWindowStyle.Hidden
            psi.CreateNoWindow = True
            MessageBox.Show("No 'print' verb associated with file extension " & IO.Path.GetExtension(file))
        End If
    Catch ex As Exception
    End Try
Share this answer
pullareddy S 23-Apr-14 1:25am    
hi ,Thanks for your reply..
For PNG images This condition always showing "False" psi.Verbs.Contains("print")
if i skip the above line i am getting a error "object reference not set to an instance of an object" at Process.Start(psi).WaitForExit()

can you please check once please.
DamithSL 23-Apr-14 1:36am    
that's true, there is no print verb for PNG files.
pullareddy S 23-Apr-14 2:13am    
hi Damith,
even PNG dont have "print" but we can print in the above code. i no need to check for the print verb. My main requirement here is i want to bind ALL images in a Folder to a SINGLE printwindow (single processstartinfo) .how can i do this .....
pullareddy S 23-Apr-14 1:35am    
And also if i run by commenting .WaitForExit() .i got 5 different windows of print for 5 images.but i want only one window with 5 images one by 1 by showing image 1 of 5, 2 of 5 like that...please check...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900