请教下 C#如何打印html页面呀 是封装好的html 网上找到了PrintDocument方法 可以给个参考例子吗 万分感谢
使用C#的WebBrowser类来打印HTML页面,代码示例如下:
using System.Windows.Forms;
WebBrowser webBrowser = new WebBrowser();
webBrowser.DocumentText = "<html><body><h1>Hello, World!</h1></body></html>";
webBrowser.Print();
WebBrowser类仅在Windows平台上可用,并且需要引用System.Windows.Forms命名空间。