Exemplo n.º 1
0
        /// <summary>
        ///     Determines the preselected profile for the printer that was used while creating the job
        /// </summary>
        /// <param name="jobInfo">The jobinfo used for the decision</param>
        /// <param name="settings">The settings used for the decision</param>
        /// <returns>The profile that is associated with the printer or the default profile</returns>
        private static ConversionProfile PreselectedProfile(IJobInfo jobInfo, clawPDFSettings settings)
        {
            foreach (var mapping in settings.ApplicationSettings.PrinterMappings)
            {
                if (mapping.PrinterName.Equals(jobInfo.SourceFiles[0].PrinterName, StringComparison.OrdinalIgnoreCase))
                {
                    var p = settings.GetProfileByGuid(mapping.ProfileGuid);
                    if (p != null)
                    {
                        return(p);
                    }
                    break;
                }
            }

            var lastUsedProfile = settings.GetLastUsedProfile();

            if (lastUsedProfile != null)
            {
                return(lastUsedProfile);
            }

            // try default profile
            var defaultProfile = SettingsHelper.GetDefaultProfile(settings.ConversionProfiles);

            if (defaultProfile != null)
            {
                return(defaultProfile);
            }

            // last resort: first profile from the list
            return(settings.ConversionProfiles[0]);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Functions checks, if a default profile exists and adds one.
        /// </summary>
        private static void CheckAndAddMissingDefaultProfile(clawPDFSettings settings)
        {
            var defaultProfile = settings.GetProfileByGuid(ProfileGuids.DEFAULT_PROFILE_GUID);

            if (defaultProfile == null)
            {
                defaultProfile      = new ConversionProfile();
                defaultProfile.Name = "<Default Profile>";
                defaultProfile.Guid = ProfileGuids.DEFAULT_PROFILE_GUID;
                settings.ConversionProfiles.Add(defaultProfile);
            }

            SetDefaultProperties(defaultProfile, false);
        }
Exemplo n.º 3
0
 public static ConversionProfile GetDefaultProfile()
 {
     return(_settings.GetProfileByGuid(ProfileGuids.DEFAULT_PROFILE_GUID));
 }