我正在开发窗口应用程序。我在使用 TXTEXTControl 打印网页或 HTML 时遇到问题。我需要做的是,将 html 传递给方法,它会打印出来。
public void PrintHtml(string html)
{
PrintDocument pd = new PrintDocument();
pd.PrinterSettings = new PrinterSettings();
pd.PrinterSettings.PrinterName = printerName;
textControl1.Text =html;
pd.PrinterSettings.PrintFileName = "d:\\abc.pdf";
pd.DefaultPageSettings.PaperSize = new PaperSize("Label", (int)textControl1.PageSize.Width, (int)textControl1.PageSize.Height);
pd.DefaultPageSettings.Margins = new Margins((int)textControl1.PageMargins.Left, (int)textControl1.PageMargins.Right, (int)textControl1.PageMargins.Top, (int)textControl1.PageMargins.Bottom);
pd.DefaultPageSettings.Landscape = false;
textControl1.Print(pd);
}
任何人,请指导我,如何打印html。