|
|
|
|
52
|
/// <param name="PDFPath">PDF文件位置</param>
|
52
|
/// <param name="PDFPath">PDF文件位置</param>
|
53
|
/// <param name="SavePath">保存文件位置 TPF</param>
|
53
|
/// <param name="SavePath">保存文件位置 TPF</param>
|
54
|
/// <param name="PrintResult">输出结果,非0为失败</param>
|
54
|
/// <param name="PrintResult">输出结果,非0为失败</param>
|
55
|
- public static void GeneratingPDF(string PDFPath, string SavePath, out int PrintResult, int PointType = 0)
|
|
|
|
|
55
|
+ /// <param name="StandardError">错误信息</param>
|
|
|
56
|
+ /// <param name="StandardOutput">输出信息["1536.688.35.70","1536.688.35.71","1536.688.35.72"]</param>
|
|
|
57
|
+ /// <param name="PointType">0 为方点,1 为圆点 默认方点</param>
|
|
|
58
|
+ public static void GeneratingPDF(string PDFPath, string SavePath, out int PrintResult, out string StandardError, out string StandardOutput, int PointType = 0)
|
56
|
{
|
59
|
{
|
57
|
//XML点阵文件位置
|
60
|
//XML点阵文件位置
|
58
|
string XmlFile = FileToolsCommon.GetFileAbsolutePath("/LatticeXML/print_license.xml");
|
61
|
string XmlFile = FileToolsCommon.GetFileAbsolutePath("/LatticeXML/print_license.xml");
|
|
|
|
|
85
|
PrintProcess.StartInfo.Arguments = ContentParameter;
|
88
|
PrintProcess.StartInfo.Arguments = ContentParameter;
|
86
|
PrintProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
89
|
PrintProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
87
|
PrintProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
90
|
PrintProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
|
|
91
|
+ PrintProcess.StartInfo.RedirectStandardOutput = true;
|
88
|
PrintProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
92
|
PrintProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
89
|
PrintProcess.StartInfo.RedirectStandardInput = true; //用于模拟该进程控制台的输入
|
93
|
PrintProcess.StartInfo.RedirectStandardInput = true; //用于模拟该进程控制台的输入
|
90
|
//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
|
94
|
//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
|
91
|
PrintProcess.ErrorDataReceived += new DataReceivedEventHandler(Output);
|
95
|
PrintProcess.ErrorDataReceived += new DataReceivedEventHandler(Output);
|
92
|
PrintProcess.Start(); //启动线程
|
96
|
PrintProcess.Start(); //启动线程
|
93
|
- PrintProcess.BeginErrorReadLine(); //开始异步读取
|
|
|
94
|
PrintProcess.WaitForExit(); //阻塞等待进程结束
|
97
|
PrintProcess.WaitForExit(); //阻塞等待进程结束
|
|
|
98
|
+ StandardError = PrintProcess.StandardError.ReadToEnd();
|
|
|
99
|
+ StandardOutput = PrintProcess.StandardOutput.ReadToEnd();
|
|
|
100
|
+ //PrintProcess.BeginErrorReadLine(); //开始异步读取
|
|
|
101
|
+ Output("【制作点阵文件】错误:" + StandardError);
|
|
|
102
|
+ Output("【制作点阵文件】返回信息:" + StandardOutput);
|
95
|
PrintResult = PrintProcess.ExitCode; //打印结果 非0则为打印失败
|
103
|
PrintResult = PrintProcess.ExitCode; //打印结果 非0则为打印失败
|
96
|
Output("【制作点阵文件】" + ContentParameter);//记录打印日志
|
104
|
Output("【制作点阵文件】" + ContentParameter);//记录打印日志
|
97
|
PrintProcess.Close(); //关闭进程
|
105
|
PrintProcess.Close(); //关闭进程
|
|
|
|
|
144
|
/// <param name="PrinterNum">打印份数</param>
|
152
|
/// <param name="PrinterNum">打印份数</param>
|
145
|
/// <param name="PrinterName">打印机名称</param>
|
153
|
/// <param name="PrinterName">打印机名称</param>
|
146
|
/// <param name="PrintResult">输出结果,非0为失败</param>
|
154
|
/// <param name="PrintResult">输出结果,非0为失败</param>
|
147
|
- public static void PrinterTPFFile(string TPFPath, int PrinterNum, string PrinterName, out int PrintResult)
|
|
|
|
|
155
|
+ /// <param name="StandardError">错误信息</param>
|
|
|
156
|
+ /// <param name="StandardOutput">输出信息</param>
|
|
|
157
|
+ public static void PrinterTPFFile(string TPFPath, int PrinterNum, string PrinterName, out int PrintResult, out string StandardError, out string StandardOutput)
|
148
|
{
|
158
|
{
|
|
|
159
|
+ TPFPath = TPFPath.Replace("/", "\\");
|
149
|
//XML点阵文件位置
|
160
|
//XML点阵文件位置
|
150
|
- string XmlFile = FileToolsCommon.GetFileAbsolutePath("/LatticeXML/print_license.xml");
|
|
|
|
|
161
|
+ //string XmlFile = FileToolsCommon.GetFileAbsolutePath("/LatticeXML/print_license.xml");
|
151
|
string ContentParameter = null;
|
162
|
string ContentParameter = null;
|
152
|
- ContentParameter = "-sMode=Print \"-sTPF =" + TPFPath + "\" \"-dCopy= " + PrinterNum + "\" \"-dPaperSize=9\" \"-sPrinter=" + PrinterName + "\"";//[-dPaperSize =]
|
|
|
|
|
163
|
+ ContentParameter = " -sMode=Print \"-sTPF=" + TPFPath + "\" \"-sPrinter=" + PrinterName + "\" \"-dCopy=" + PrinterNum + "\"";//\"-dPaperSize=9\"
|
153
|
#region 打印参数说明
|
164
|
#region 打印参数说明
|
154
|
//-sMode = Print,参数如下:
|
165
|
//-sMode = Print,参数如下:
|
155
|
//PrintTool.exe - sMode = Print - sTPF = [-dCopy =][-dPaperSize =] - sPrinter =
|
166
|
//PrintTool.exe - sMode = Print - sTPF = [-dCopy =][-dPaperSize =] - sPrinter =
|
|
|
|
|
172
|
}
|
183
|
}
|
173
|
PrintProcess = new Process();
|
184
|
PrintProcess = new Process();
|
174
|
LogPath = CreateLog();
|
185
|
LogPath = CreateLog();
|
175
|
- PrintProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath("/PrintTool/PrintTool.exe"); //绝对路径
|
|
|
|
|
186
|
+ PrintProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath("/PrintTool/PrintTool.exe").Replace("/", "\\"); ; //绝对路径
|
176
|
PrintProcess.StartInfo.Arguments = ContentParameter;
|
187
|
PrintProcess.StartInfo.Arguments = ContentParameter;
|
177
|
PrintProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
188
|
PrintProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
178
|
PrintProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
189
|
PrintProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
|
|
|
|
181
|
//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
|
192
|
//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
|
182
|
PrintProcess.ErrorDataReceived += new DataReceivedEventHandler(Output);
|
193
|
PrintProcess.ErrorDataReceived += new DataReceivedEventHandler(Output);
|
183
|
PrintProcess.Start(); //启动线程
|
194
|
PrintProcess.Start(); //启动线程
|
184
|
- PrintProcess.BeginErrorReadLine(); //开始异步读取
|
|
|
|
|
195
|
+ //PrintProcess.BeginErrorReadLine(); //开始异步读取
|
185
|
PrintProcess.WaitForExit(); //阻塞等待进程结束
|
196
|
PrintProcess.WaitForExit(); //阻塞等待进程结束
|
|
|
197
|
+ StandardError = PrintProcess.StandardError.ReadToEnd();
|
|
|
198
|
+ StandardOutput = PrintProcess.StandardOutput.ReadToEnd();
|
|
|
199
|
+ Output("【制作点阵文件】错误:" + StandardError);
|
|
|
200
|
+ Output("【制作点阵文件】返回信息:" + StandardOutput);
|
186
|
PrintResult = PrintProcess.ExitCode; //打印结果 非0则为打印失败
|
201
|
PrintResult = PrintProcess.ExitCode; //打印结果 非0则为打印失败
|
187
|
Output("【打印TPF文件】" + ContentParameter);//记录打印日志
|
202
|
Output("【打印TPF文件】" + ContentParameter);//记录打印日志
|
188
|
PrintProcess.Close(); //关闭进程
|
203
|
PrintProcess.Close(); //关闭进程
|