private bool PrintDoc(FileSendOnNet file)
        {
            PclFileID = this.PostFile2Server();
            if (!String.IsNullOrWhiteSpace(PclFileID))
            {
                /**Post提交成功**下载文件*/
                String PclFileName = null;
                Thread.Sleep(300);
                int TimeCount = 0;
                while (String.IsNullOrEmpty(PclFileName = this.DownloadPCLFile()))
                {
                    //未准备好
                    if (TimeCount++ < 10)
                    {
                        Thread.Sleep(500);
                    }
                }


                if (!String.IsNullOrEmpty(PclFileName))
                {
                    /*--下载成功-*/
                    SendPCL2Printer s2p = new SendPCL2Printer();
                    return(s2p.SendFile2Printer(PclFileName, file.GetPrinterName()));
                }
            }
            return(false);
        }
        private bool PrintDoc(FileSendOnNet file)
        {
            String FilePath = file.mFileFullPath;
            int    flag     = 0;

            PCLConvertCS.PCLConvert pc    = new PCLConvertCS.PCLConvert();
            PCLConvertCS.PDFConvert pcpdf = new PCLConvertCS.PDFConvert();
            string fileOut = file.GetPCLprnfullPath();
            string printer;

            if (file.GetPrinterName().Equals(""))
            {
                printer = PrintLocalPrint.LocalPrinter.DefaultPrinter();
            }
            else
            {
                printer = file.GetPrinterName();
            }

            if (FilePath.ToLower().EndsWith("doc") || FilePath.ToLower().EndsWith("docx"))
            {
                string result = pc.WordToPCL(readArgs(FilePath), fileOut, printer);
                if (result == null)
                {
                    flag = 1;
                }
            }
            if (FilePath.ToLower().EndsWith("pdf"))
            {
                string result = pcpdf.ConvertPdf2pcl(readArgs(FilePath), 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") || FilePath.ToLower().EndsWith("xls"))
            {
#if false
                string sPath = System.IO.Path.GetTempPath() + System.IO.Path.GetFileName(FilePath).Replace(".", "_") + ".pdf";
                Method m     = new Method();

                if (m.Convert2PDF(FilePath, sPath, Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF))
                {
                    string result = pcpdf.ConvertPdf2pcl(readArgs(sPath), fileOut);
                    if (result == null)
                    {
                        flag = 1;
                    }
                }
#else
                string sPath = System.IO.Path.GetTempPath() + System.IO.Path.GetFileNameWithoutExtension(FilePath) + Guid.NewGuid().ToString() + ".pdf";
                Method m     = new Method();

                if (m.Convert2PDF(FilePath, sPath, Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF))
                {
#if true
                    string result = pcpdf.ConvertPdf2pcl(readArgs(sPath), fileOut);
#else
                    string result = "测试";
#endif
                    if (result == null)
                    {
                        flag = 1;
                    }
                }
#endif
            }
            if (flag == 1)
            {
                //文件转换成功-发送到打印机
                SendPCL2Printer s2p = new SendPCL2Printer();

                return(s2p.SendFile2Printer(fileOut, printer));
            }
            else
            {
                Debug.Assert(false);
                //文件转换失败
                return(false);
            }
        }
        private bool PrintDoc(FileSendOnNet file)
        {
            String FilePath = file.mFileFullPath;
            int    flag     = 0;

            PCLConvertCS.PCLConvert pc    = new PCLConvertCS.PCLConvert();
            PCLConvertCS.PDFConvert pcpdf = new PCLConvertCS.PDFConvert();
            string fileOut = file.GetPCLprnfullPath();
            string printer;
            string result = null;

            if (file.GetPrinterName().Equals(""))
            {
                printer = PrintLocal.GetPCLPrinter();
            }
            else
            {
                printer = file.GetPrinterName();
            }

            if (FilePath.ToLower().EndsWith("doc") || FilePath.ToLower().EndsWith("docx"))
            {
                //Step 1
                try{
                    result = pc.WordToPCL(readArgs(FilePath), fileOut, printer);
                    if (result != null)
                    {
                        LogHelper.WriteLog(this.GetType(), "WORD2PCL 转换失败" + result);
                        result = pc.Word2PDFToPCL(readArgs(FilePath), fileOut, printer);
                    }
                }catch (Exception e) {
                    LogHelper.WriteLog(this.GetType(), e.Message);
                }
                finally {
                    if (result == null)
                    {
                        flag = 1;    //转换成功
                    }
                }
            }
            if (FilePath.ToLower().EndsWith("pdf"))
            {
                try
                {
                    result = pcpdf.ConvertPdf2pcl(readArgs(FilePath), fileOut);
                    if (result == null)
                    {
                        flag = 1;     //装换成功
                    }
                    else
                    {
                        //转换失败
                    }
                }
                catch (Exception e)
                {
                    LogHelper.WriteLog(this.GetType(), e.Message);
                }
            }
            if (FilePath.ToLower().EndsWith("jpg") || FilePath.ToLower().EndsWith("jpeg") || FilePath.ToLower().EndsWith("JPEG"))
            {
                result = pc.JPGToPCL(FilePath, fileOut);
                if (result == null)
                {
                    flag = 1;
                }
            }
            if (FilePath.ToLower().EndsWith("xlsx") || FilePath.ToLower().EndsWith("xlsm") || FilePath.ToLower().EndsWith("xls"))
            {
#if false
                string sPath = System.IO.Path.GetTempPath() + System.IO.Path.GetFileName(FilePath).Replace(".", "_") + ".pdf";
                Method m     = new Method();

                if (m.Convert2PDF(FilePath, sPath, Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF))
                {
                    string result = pcpdf.ConvertPdf2pcl(readArgs(sPath), fileOut);
                    if (result == null)
                    {
                        flag = 1;
                    }
                }
#else
                string sPath = System.IO.Path.GetTempPath() + System.IO.Path.GetFileNameWithoutExtension(FilePath) + Guid.NewGuid().ToString() + ".pdf";
                Method m     = new Method();

                if (m.Convert2PDF(FilePath, sPath, Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF))
                {
#if true
                    result = pcpdf.ConvertPdf2pcl(readArgs(sPath), fileOut);
#else
                    string result = "测试";
#endif
                    if (result == null)
                    {
                        flag = 1;
                    }
                }
#endif
            }
            if (flag == 1)
            {
                //文件转换成功-发送到打印机
                LogHelper.WriteLog(this.GetType(), "文件转换成功");
                SendPCL2Printer s2p = new SendPCL2Printer();
                return(s2p.SendFile2Printer(fileOut, printer));
            }
            else
            {
                LogHelper.WriteLog(this.GetType(), "文件转换:" + result + "&&&" + FilePath);
                //文件转换失败
                return(false);
            }
            //return false;
        }