工作中存在需要把图片打印出来,现在记录代码实现方式。
public static void PdfPrint()
{
string msg = string.Empty;
try
{
#region 打印图片文件
imageIndex = 0;
//打印字符串用
SolidBrush brush = new SolidBrush(System.Drawing.Color.Black);
System.Drawing.Font DrawFont = new System.Drawing.Font("Arial", 30);
PrintDocument pda = new PrintDocument();
pda.PrintPage += PicturePrintDocument_PrintPage; //注册打印事件
pda.PrinterSettings.PrinterName = "Zan 黑白图像打印机"; //打印机选择,使用默认打印机不需要设置
pda.Print();
#endregion
}
catch (Exception ex)
{
msg = "ReportPrint:" + ex.Message;
}
}
private static void PicturePrintDocument_PrintPage(object sender, System.Dr