Loop Through HTML Files in a Folder & Silently Print Them To The Default Printer via IE
<p>I'm trying to cobble together a short bit of console code to print some HTML files in a folder through Internet Explorer to the default printer. I have found a the following code below from <a href="http://weblogs.asp.net/israelio/archive/2004/06/23/162913.aspx" rel="nofollow">http://weblogs.asp.net/israelio/archive/2004/06/23/162913.aspx</a> which appears to almost suit my needs.</p>

<p>I have have made a couple of alterations but my programming skills are very limited. I'm looking for some help making sure the syntax is correct and someone to show me how to silently print via Internet Explorer and not to open Internet Explorer as I beleive it stands now.</p>

<p>Any help would be greatly appreaciated... </p>

<pre><code>using System
using System.IO

// How much deep to scan. (of course you can also pass it to the method)
const int HowDeepToScan=4; 

public static void ProcessDir(string sourceDir, int recursionLvl) 
{
if (recursionLvl&lt;=HowDeepToScan)
{
// Process the list of files found in the directory. 
string [] fileEntries = Directory.GetFiles(@"C:\fileDump\", "*.html");  
foreach(string fileName in fileEntries)
{
   // do something with fileName
   System.Diagnostics.Process.Start(fileName);
}

// Recurse into subdirectories of this directory.
string [] subdirEntries = Directory.GetDirectories((@"C:\fileDump);
foreach(string subdir in subdirEntries)
   // Do not iterate through reparse points
   if ((File.GetAttributes(subdir) &amp;
        FileAttributes.ReparsePoint) !=
            FileAttributes.ReparsePoint)

        ProcessDir(subdir,recursionLvl+1);
}
}
</code></pre>
