Home > DeveloperSection > Forums > How do I print an HTML document from a web service?
alexander sabato
alexander sabato

Total Post:4

Points:28
Posted on    February-04-2013 2:11 AM

 C# C# 
Ratings:


 1 Reply(s)
 1275  View(s)
Rate this:

Hi Expert!

How to print HTML document using command line and C#.

Thanks in advance



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    February-04-2013 5:52 AM

Hi Alexander Sabato!

Run this command into command prompt

rundll32.exe %WINDIR%\System32\mshtml.dll,PrintHTML "FilePath"

If you are using C#, than used line of code as below

using (Process printProcess = new Process())
{
    string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
    printProcess.StartInfo.FileName = systemPath + @"\rundll32.exe";
    printProcess.StartInfo.Arguments = systemPath + @"\mshtml.dll,PrintHTML """ + FilePath + @"""";
    printProcess.Start();
}

Note: Here "FilePath", represent path of document which you want to print.


Don't want to miss updates? Please click the below button!

Follow MindStick