public HttpRsepData Post2ReceiveData(string strUrl, string HttpRequestData)
        {
            HttpRsepData RespData = new HttpRsepData();
            Encoding     encode   = System.Text.Encoding.UTF8;

            //注意提交的编码 这边是需要改变的 这边默认的是Default:系统当前编码
#if false
            byte[] arrB = encode.GetBytes(HttpRequestData);
#else
            byte[] arrB = Encoding.UTF8.GetBytes(HttpRequestData);
#endif

            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest  myReq           = (HttpWebRequest)WebRequest.Create(strUrl);
            myReq.Method          = "POST";
            myReq.ContentType     = "application/x-www-form-urlencoded";
            myReq.ContentLength   = arrB.Length;
            myReq.CookieContainer = cookieContainer;
            try
            {
                Stream outStream = myReq.GetRequestStream();    //其他信息: 无法连接到远程服务器
                outStream.Write(arrB, 0, arrB.Length);
                outStream.Close();
            }
            catch (Exception ex)
            {
                shijian();
                MessageBox.Show("网络错误,请稍后连接!");
            }

            WebResponse myResp = null;

            try
            {
                //接收HTTP做出的响应
                myResp = myReq.GetResponse();
            }
            catch (Exception e)
            {
                int ii = 0;
            }
            if (myResp != null)
            {
                RespData.RespStatus = ((HttpWebResponse)myResp).StatusDescription;
                if (RespData.RespStatus == HttpOK)
                {
                    RespData.RespStatusCode = 200;
                    Encoding     respencode    = System.Text.Encoding.UTF8;
                    Stream       ReceiveStream = myResp.GetResponseStream();
                    StreamReader readStream    = new StreamReader(ReceiveStream, respencode);
                    RespData.RespData = readStream.ReadToEnd();
                    Jsontext          = RespData.RespData;
                }
                else if (RespData.RespStatus == HttpNotFing)
                {
                    RespData.RespStatusCode = 400;
                }
                else
                {
                    RespData.RespStatusCode = -1;
                }
            }
            else
            {
                RespData.RespStatus     = "服务器未连接-HttpWebRequest";
                RespData.RespStatusCode = -1;
            }
            return(RespData);
        }
        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);
                }
            }
        }