/// <summary> /// 要测试打印的时候被触发 /// </summary> public void TestPrint() { // 运行Script代码 if (this.PrintAssembly != null) { PrintEventArgs e = new PrintEventArgs(); e.PrintInfo = this.PrintHostObj.PrintInfo; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnTestPrint(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } } }
// 创建打印内容 /// <summary> /// 要创建打印内容时被触发 /// </summary> /// <param name="info">打印信息</param> /// <param name="strResultString">结果字符串</param> /// <param name="strResultFormat">结果字符串的格式</param> public void GetPrintContent(PrintInfo info, out string strResultString, out string strResultFormat) { strResultString = ""; strResultFormat = ""; // 运行Script代码 if (this.PrintAssembly != null) { PrintEventArgs e = new PrintEventArgs(); e.PrintInfo = info; e.Action = "create"; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnPrint(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } strResultString = e.ResultString; strResultFormat = e.ResultFormat; } }
/// <summary> /// 打印 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnPrint(object sender, PrintEventArgs e) { }
/// <summary> /// 清除打印机配置 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnClearPrinterPreference(object sender, PrintEventArgs e) { }
/// <summary> /// 测试打印 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnTestPrint(object sender, PrintEventArgs e) { }