///
/// 打印
///
/// 安装的打印机名
/// 打印文件路径
///
public bool Print(string printerName, string filePath)
{
bool result = true;
try
{
//开始打印
streamToPrint = new StreamReader(filePath, System.Text.Encoding.Default);
PrintDocument pd = new PrintDocument();
pd.DefaultPageSettings.Margins.Top = 2;
pd.DefaultPageSettings.Margins.Left = 12;
pd.DefaultPageSettings.PaperSize.Width = 320;
pd.DefaultPageSettings.PaperSize.Height = 5150;
pd.PrinterSettings.PrinterName = printerName;
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
}
catch (Exception ex)
{
result = false;
}
finally
{
if (streamToPrint != null)
streamToPrint.Close();
}
以前做过的打印机 也是热敏的
崩溃。是吗?