Example #1
0
        public bool ConvertToPdf(string sourceFile, string saveAsFile)
        {
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(sourceFile);
            IGHPrinterDefine   obj      = this.GetObj(fileInfo.Extension.ToLower());
            bool result;

            if (obj != null)
            {
                this.CheckDir(saveAsFile);
                try
                {
                    if (obj.LoadSourceFile(sourceFile))
                    {
                        result = obj.ConvertToPdf(saveAsFile);
                        return(result);
                    }
                }
                catch (System.Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    obj.Dispose();
                }
            }
            result = false;
            return(result);
        }
Example #2
0
        public bool RegPrintClass(string printType, IGHPrinterDefine printObject)
        {
            bool result;

            if (!string.IsNullOrEmpty(printType) && printObject != null)
            {
                printType = printType.ToLower();
                string[] array = printType.Split(",".ToCharArray());
                if (array != null && array.Length > 0)
                {
                    string[] array2 = array;
                    for (int i = 0; i < array2.Length; i++)
                    {
                        string key = array2[i];
                        if (!this.InstanceList.ContainsKey(key))
                        {
                            this.InstanceList.Add(key, null);
                        }
                        this.InstanceList[key] = printObject;
                    }
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
Example #3
0
        public bool PrintToFile(string sourceFile, string saveAsFile, System.Collections.Hashtable data)
        {
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(sourceFile);
            IGHPrinterDefine   obj      = this.GetObj(fileInfo.Extension.ToLower());
            bool result;

            if (obj != null)
            {
                this.CheckDir(saveAsFile);
                try
                {
                    BaseInit.InitConstValues(data);
                    if (obj.LoadSourceFile(sourceFile) && obj.LoadData(data))
                    {
                        result = obj.BuildFile(saveAsFile);
                        return(result);
                    }
                }
                catch (System.Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    obj.Dispose();
                }
            }
            result = false;
            return(result);
        }