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
VB
dim psinfo as new processstartinfo
psinfo.verb="print"
psinfo.createnowindow=false
psinfo.filename="d:/imgfolder/0001.jpg"
process.start(psinfo)


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 vb.net if Anyone know how to do this please reply....
Posted
Updated 16-Oct-18 3:31am
v2

1 solution

check below code

VB
For Each file In IO.Directory.GetFiles(folderPath)
    Try
        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
            Process.Start(psi).WaitForExit()
        Else
            MessageBox.Show("No 'print' verb associated with file extension " & IO.Path.GetExtension(file))
        End If
    Catch ex As Exception
        MessageBox.Show(ex.ToString())
    End Try
Next


http://www.vbforums.com/showthread.php?609098-Print-all-files-in-folder&p=3764285&viewfull=1#post3764285[^]
 
Share this answer
 
v2
Comments
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()
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