如何在不使用Webbrowser控件的情况下用c#打印HTML documnet [英] How to print the HTML documnet in c# with out using the Webbrowser control

查看:125
本文介绍了如何在不使用Webbrowser控件的情况下用c#打印HTML documnet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,

请帮助我如何在不使用Web浏览器控件的情况下用c#打印HTML文档.

Please help me how to print the HTML document in c# without using the web browser control.

我尝试使用相同的代码,但是它将弹出打印对话框.我如何禁用该对话框并打印到默认打印机.

I have tried with the same code but it will popup the print dialog box. How can i disable the dialog box and print to default printer.?

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 """ + document + @"""";
              
             printProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

             printProcess.Start();
   }



.

我尝试使用以下代码但无法正常工作.请帮助我如何在没有Web浏览器控制的情况下打印HTML页面.

I have tried with the below code but not working.Please help me how to print the HTML page without web browser control.

推荐答案

您好,

请参见以下标记为答案的答案.

See the following marked answer.

http ://stackoverflow.com/questions/10572420/how-to-skip-the-dialog-of-printing-in-printdocument-print-and-print-page-direc


这篇关于如何在不使用Webbrowser控件的情况下用c#打印HTML documnet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆