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 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);
        }