void PrintFiles() { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; Process p = new Process();//Create new process for printing startInfo.Verb = "PRINT";//print command to execute startInfo.CreateNoWindow = true;//supress the print dialog. startInfo.WindowStyle = ProcessWindowStyle.Hidden; string path = Server.MapPath("~/Documents/"); //Get all the files from the Directory in string array string[] docFiles = Directory.GetFiles(path); //Loop through the files for (int count = 0; count < docFiles.Length; count++) { startInfo.FileName = docFiles[count]; //document to print p.StartInfo = startInfo; //Associate the print command and the filename to print with the process. p.Start();//Start printing. } p.Dispose(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)