public bool SendFile2Printer(String fileOut, String printer)
        {
            ;
            PCLConvertCS.PCLToPrinter pcl = new PCLConvertCS.PCLToPrinter();
            // 设置事件触发间隔
            pcl.SetEventTimeout(2000);
            // 添加打印监控事件处理handler
            pcl.OnPCLResult += new PCLConvertCS.PCLToPrinter.PCLResult(pcl_OnPCLResult);
            string result1 = pcl.SendFileToPrinter(printer, fileOut);

            if (result1 == null)
            {
                return(true);
            }
            else
            {
                LogHelper.WriteLog(this.GetType(), "文件发送:" + result1 + printer + fileOut);
                return(false);
            }
        }
        public bool SendFile2Printer(String fileOut, String printer)
        {
            ;
            PCLConvertCS.PCLToPrinter pcl = new PCLConvertCS.PCLToPrinter();
            // 设置事件触发间隔
            pcl.SetEventTimeout(2000);
            // 添加打印监控事件处理handler
            pcl.OnPCLResult += new PCLConvertCS.PCLToPrinter.PCLResult(pcl_OnPCLResult);
            string result1 = pcl.SendFileToPrinter(printer, fileOut);

            if (result1 == null)
            {
                return(true);
            }
            else
            {
                Debug.Assert(false);
                return(false);
            }
        }
        public void  GetPrintTaskInfo()
        {
            string       orderid        = "";
            string       copies         = "";
            string       fileid         = "";
            string       filetype       = "";
            string       filename       = "";
            string       printer        = "";
            string       page           = "";
            string       peisong        = "";
            string       time           = "";
            bool         isdouble       = false;
            bool         iscolor        = false;
            int          flag           = 0;
            String       post_send_data = "userID=" + c_userID + "&" + "licenseCode=" + c_licenseCode;
            HttpRsepData RespData       = Post2ReceiveData(this.url_GetTask, post_send_data);

            if (Jsontext != "" && Jsontext != null)
            {
                GetPrintTask  obj       = new GetPrintTask();
                List <Object> orderlist = obj.getTaskFromCloud(Jsontext);//获得云中任务
                List <report> r         = new List <report>();
                if (orderlist.Count != 0)
                {
                    for (int i = 0; i < orderlist.Count; i++)
                    {
                        Orders order = (Orders)orderlist[i];


                        if (order.IsDuplex == "1")
                        {
                            isdouble = false;
                        }
                        if (order.IsDuplex == "2")
                        {
                            isdouble = true;
                        }
                        if (order.Iscolor == "黑白")
                        {
                            iscolor = false;
                        }
                        else
                        {
                            iscolor = true;
                        }
                        copies   = order.Printcopies;
                        fileid   = order.FileID;
                        filetype = order.Filetype;
                        page     = order.Prtpage;
                        filename = order.Filename;
                        peisong  = order.Peisong;
                        printer  = order.Printer;

                        string   printers = PCLConvertCS.PCLToPrinter.GetAllPrinter();
                        string[] all      = printers.Split(';');
                        string   x        = "";
                        string   murl     = url;
                        murl += "/machine/privateDownloadFileHandler.ashx";
                        DownLoadFile obj2 = new DownLoadFile(@murl);
                        obj2.getFileFromCloud(orderlist);
                        string FilePath = System.IO.Directory.GetCurrentDirectory() + @"\下载文档\";
                        FilePath += fileid + "." + filetype;
                        string fileOut                = System.IO.Directory.GetCurrentDirectory() + @"\PCL\" + fileid + ".prn";//移动到哪里
                        PCLConvertCS.PCLConvert pc    = new PCLConvertCS.PCLConvert();
                        PCLConvertCS.PDFConvert pcpdf = new PCLConvertCS.PDFConvert();
                        string fileOutFJ              = System.IO.Directory.GetCurrentDirectory() + @"\PCL\" + fileid + "FJ" + ".prn";

                        if (FilePath.ToLower().EndsWith("doc") || FilePath.ToLower().EndsWith("docx"))
                        {
                            string result = pc.WordToPCL(readArgs(FilePath, copies, iscolor, isdouble, page), fileOut, printer);
                            if (result == null)
                            {
                                flag = 1;
                            }
                        }
                        if (FilePath.ToLower().EndsWith("pdf"))
                        {
                            string result = pcpdf.ConvertPdf2pcl(readArgs(FilePath, copies, iscolor, isdouble, page), fileOut);
                            if (result == null)
                            {
                                flag = 1;
                            }
                        }
                        if (FilePath.ToLower().EndsWith("jpg") || FilePath.ToLower().EndsWith("jpeg") || FilePath.ToLower().EndsWith("JPEG"))
                        {
                            string result = pc.JPGToPCL(FilePath, fileOut);
                            if (result == null)
                            {
                                flag = 1;
                            }
                        }
                        if (FilePath.ToLower().EndsWith("xlsx") || FilePath.ToLower().EndsWith("xlsm"))
                        {
                            string sPath = System.IO.Directory.GetCurrentDirectory() + @"\下载文档\" + "\\" + orderid + "\\" + fileid;
                            if (XLSConvertToPDF(FilePath, sPath))
                            {
                                FilePath = sPath + ".pdf";
                                string result = pcpdf.ConvertPdf2pcl(readArgs(FilePath, copies, iscolor, isdouble, page), fileOut);
                                if (result == null)
                                {
                                    flag = 1;
                                }
                            }
                        }
                        if (flag == 1)
                        {
                            string fileOut1 = System.IO.Directory.GetCurrentDirectory() + @"\PCL\" + fileid + ".prn";
                            PCLConvertCS.PCLToPrinter pcl = new PCLConvertCS.PCLToPrinter();
                            // 设置事件触发间隔
                            pcl.SetEventTimeout(2000);
                            // 添加打印监控事件处理handler
                            pcl.OnPCLResult += new PCLConvertCS.PCLToPrinter.PCLResult(pcl_OnPCLResult);
                            string result1 = pcl.SendFileToPrinter(printer, fileOut1);
                            string userid  = order.OrderID;
                            countpage(FilePath);
                            int xpage = 0;
                            if (page == "全部")
                            {
                                xpage = mnum;
                            }
                            else
                            {
                                xpage = m_lastPage - m_firstPage + 1;
                            }
                            int    totalPage = Convert.ToInt32(copies) * xpage;
                            report a         = new report();
                            a.Orderid = order.OrderID;
                            a.Pagenum = totalPage;
                            DirectoryInfo dirInfo = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + @"\PCL\");
                            FileInfo[]    files   = dirInfo.GetFiles(); // 获取该目录下的所有文件
                            foreach (FileInfo file in files)
                            {
                                file.Delete();
                            }

                            r.Add(a);
                        }
                    }

                    ReportData R = new ReportData();
                    R.ReportCloud(CreateJsonParameters(r), @url);
                }
            }
        }