Exemple #1
0
        /// <summary>
        /// Verifica se il file richiesto può essere convertito in formato pdf
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static bool CanConvertFileToPdf(string fileName)
        {
            try
            {
                if (!string.IsNullOrEmpty(fileName))
                {
                    bool retValue = false;

                    string[] fileTypes = GetConvertiblePdfFileTypes();

                    if (fileTypes != null)
                    {
                        FileInfo fileInfo = new FileInfo(fileName);
                        string   fileExt  = fileInfo.Extension.Replace(".", "").ToLower();

                        foreach (string fileType in fileTypes)
                        {
                            retValue = (fileType.Equals("*") || fileType.ToLower().Equals(fileExt));

                            if (retValue)
                            {
                                break;
                            }
                        }
                    }

                    return(_ws.CanConvertFileToPdf(fileName));
                }
                else
                {
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// Verifica se il file richiesto può essere convertito in formato pdf
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static bool CanConvertFileToPdf(string fileName)
        {
            bool retValue = false;

            string[] fileTypes = GetConvertiblePdfFileTypes();

            if (fileTypes != null)
            {
                FileInfo fileInfo = new FileInfo(fileName);
                string   fileExt  = fileInfo.Extension.Replace(".", "").ToLower();

                foreach (string fileType in fileTypes)
                {
                    retValue = (fileType.Equals("*") || fileType.ToLower().Equals(fileExt));

                    if (retValue)
                    {
                        break;
                    }
                }
            }

            return(_ws.CanConvertFileToPdf(fileName));
        }