Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i using this code for print with windows print pictures
C#
string fileName = @"C:\Images\12.jpg";
var p = new Process();
p.StartInfo.FileName = fileName;
p.StartInfo.Verb = "Print";
p.Start();

i want open multiple images from directory into this, how can i do it?
With Respect
Posted

1 solution

This should find all ".jpg" files in the folder "C:\Images".
C#
DirectoryInfo d = new DirectoryInfo(@"C:\Images");
FileInfo[] Files = d.GetFiles("*.jpg");
foreach(FileInfo file in Files )
{
   var p = new Process();
   p.StartInfo.FileName = file.fileName;
   p.StartInfo.Verb = "Print";
   p.Start();
}
 
Share this answer
 
Comments
Avenger1 27-Feb-15 16:41pm    
it opened for 100 time for each image, i want to open once and show all images just like when you select all images then right click and click to print
HKHerron 27-Feb-15 21:05pm    
How many .jpg files are in c:\images?
Avenger1 28-Feb-15 0:12am    
between 100 to 1000 images are in that folder
HKHerron 28-Feb-15 10:32am    
OH, WOW. 100-1000 is a large range.
Did you try stepping through it in debug to see if the file.filename is actually changing through each file found? You can also add a line with int x = Files.Count(); and see how many files are found.

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