Esempio n. 1
0
 private void InstallDefaultProfileSet(PdfCreatorSettings settings)
 {
     settings.ConversionProfiles.Add(CreateDefaultProfile());
     settings.ConversionProfiles.Add(CreateHighCompressionProfile());
     settings.ConversionProfiles.Add(CreateHighQualityProfile());
     settings.ConversionProfiles.Add(CreateJpegProfile());
     settings.ConversionProfiles.Add(CreatePdfaProfile());
     settings.ConversionProfiles.Add(CreatePngProfile());
     settings.ConversionProfiles.Add(CreatePrintProfile());
     settings.ConversionProfiles.Add(CreateTiffProfile());
     settings.SortConversionProfiles();
 }
Esempio n. 2
0
        private void InstallDefaultProfileSet(PdfCreatorSettings settings)
        {
            settings.ConversionProfiles.Add(CreateDefaultProfile());
            settings.ConversionProfiles.Add(CreateHighCompressionProfile());
            settings.ConversionProfiles.Add(CreateSecuredPdfProfile());
            settings.ConversionProfiles.Add(CreateHighQualityProfile());
            settings.ConversionProfiles.Add(CreateJpegProfile());
            settings.ConversionProfiles.Add(CreatePdfaProfile());
            settings.ConversionProfiles.Add(CreatePngProfile());
            settings.ConversionProfiles.Add(CreatePrintProfile());
            settings.ConversionProfiles.Add(CreateTiffProfile());

            foreach (var profile in settings.ConversionProfiles)
            {
                profile.EmailClientSettings.AddSignature = WithEmailSignature;
                profile.EmailSmtpSettings.AddSignature   = WithEmailSignature;
            }

            settings.SortConversionProfiles();
        }
Esempio n. 3
0
        /// <summary>
        ///     Creates a settings object with default settings and profiles
        /// </summary>
        /// <returns>The initialized settings object</returns>
        private static PdfCreatorSettings CreateDefaultSettings()
        {
            PdfCreatorSettings settings = CreateEmptySettings();

            settings.ApplicationSettings.PrimaryPrinter = FindPrimaryPrinter();

            CheckAndAddMissingDefaultProfile(settings);

            #region add default profiles

            //HighComressionProfile
            var highCompressionProfile = new ConversionProfile();
            highCompressionProfile.Name = "High Compression (small files)";
            highCompressionProfile.Guid = ProfileGuids.HIGH_COMPRESSION_PROFILE_GUID;

            highCompressionProfile.OutputFormat = OutputFormat.Pdf;
            highCompressionProfile.PdfSettings.CompressColorAndGray.Enabled     = true;
            highCompressionProfile.PdfSettings.CompressColorAndGray.Compression = CompressionColorAndGray.JpegMaximum;

            highCompressionProfile.PdfSettings.CompressMonochrome.Enabled     = true;
            highCompressionProfile.PdfSettings.CompressMonochrome.Compression = CompressionMonochrome.RunLengthEncoding;

            highCompressionProfile.JpegSettings.Dpi     = 100;
            highCompressionProfile.JpegSettings.Color   = JpegColor.Color24Bit;
            highCompressionProfile.JpegSettings.Quality = 50;

            highCompressionProfile.PngSettings.Dpi   = 100;
            highCompressionProfile.PngSettings.Color = PngColor.Color24Bit;

            highCompressionProfile.TiffSettings.Dpi   = 100;
            highCompressionProfile.TiffSettings.Color = TiffColor.Color24Bit;

            SetDefaultProperties(highCompressionProfile, true);
            settings.ConversionProfiles.Add(highCompressionProfile);

            //HighQualityProfile
            var highQualityProfile = new ConversionProfile();
            highQualityProfile.Name = "High Quality (large files)";
            highQualityProfile.Guid = ProfileGuids.HIGH_QUALITY_PROFILE_GUID;

            highQualityProfile.OutputFormat = OutputFormat.Pdf;
            highQualityProfile.PdfSettings.CompressColorAndGray.Enabled     = true;
            highQualityProfile.PdfSettings.CompressColorAndGray.Compression = CompressionColorAndGray.Zip;
            highQualityProfile.PdfSettings.CompressMonochrome.Enabled       = true;
            highQualityProfile.PdfSettings.CompressMonochrome.Compression   = CompressionMonochrome.Zip;

            highQualityProfile.JpegSettings.Dpi     = 300;
            highQualityProfile.JpegSettings.Quality = 100;
            highQualityProfile.JpegSettings.Color   = JpegColor.Color24Bit;

            highQualityProfile.PngSettings.Dpi   = 300;
            highQualityProfile.PngSettings.Color = PngColor.Color32BitTransp;

            highQualityProfile.TiffSettings.Dpi   = 300;
            highQualityProfile.TiffSettings.Color = TiffColor.Color24Bit;

            SetDefaultProperties(highQualityProfile, true);
            settings.ConversionProfiles.Add(highQualityProfile);

            //JpegProfile
            var jpegProfile = new ConversionProfile();
            jpegProfile.Name = "JPEG (graphic file)";
            jpegProfile.Guid = ProfileGuids.JPEG_PROFILE_GUID;

            jpegProfile.OutputFormat         = OutputFormat.Jpeg;
            jpegProfile.JpegSettings.Dpi     = 150;
            jpegProfile.JpegSettings.Color   = JpegColor.Color24Bit;
            jpegProfile.JpegSettings.Quality = 75;

            SetDefaultProperties(jpegProfile, true);
            settings.ConversionProfiles.Add(jpegProfile);

            //PdfAProfile
            var pdfaProfile = new ConversionProfile();
            pdfaProfile.Name = "PDF/A (long term preservation)";
            pdfaProfile.Guid = ProfileGuids.PDFA_PROFILE_GUID;

            pdfaProfile.OutputFormat = OutputFormat.PdfA2B;
            pdfaProfile.PdfSettings.CompressColorAndGray.Enabled     = true;
            pdfaProfile.PdfSettings.CompressColorAndGray.Compression = CompressionColorAndGray.Automatic;
            pdfaProfile.PdfSettings.CompressMonochrome.Enabled       = true;
            pdfaProfile.PdfSettings.CompressMonochrome.Compression   = CompressionMonochrome.CcittFaxEncoding;

            SetDefaultProperties(pdfaProfile, true);
            settings.ConversionProfiles.Add(pdfaProfile);

            //PngProfile
            var pngProfile = new ConversionProfile();
            pngProfile.Name = "PNG (graphic file)";
            pngProfile.Guid = ProfileGuids.PNG_PROFILE_GUID;

            pngProfile.OutputFormat      = OutputFormat.Png;
            pngProfile.PngSettings.Dpi   = 150;
            pngProfile.PngSettings.Color = PngColor.Color24Bit;

            SetDefaultProperties(pngProfile, true);
            settings.ConversionProfiles.Add(pngProfile);

            //PrintProfile
            var printProfile = new ConversionProfile();
            printProfile.Name = "Print after saving";
            printProfile.Guid = ProfileGuids.PRINT_PROFILE_GUID;

            printProfile.Printing.Enabled       = true;
            printProfile.Printing.SelectPrinter = SelectPrinter.ShowDialog;

            SetDefaultProperties(printProfile, true);
            settings.ConversionProfiles.Add(printProfile);

            //TiffProfile
            var tiffProfile = new ConversionProfile();
            tiffProfile.Name = "TIFF (multipage graphic file)";
            tiffProfile.Guid = ProfileGuids.TIFF_PROFILE_GUID;

            tiffProfile.OutputFormat       = OutputFormat.Tif;
            tiffProfile.TiffSettings.Dpi   = 150;
            tiffProfile.TiffSettings.Color = TiffColor.Color24Bit;

            SetDefaultProperties(tiffProfile, true);
            settings.ConversionProfiles.Add(tiffProfile);

            #endregion

            var startReplacements = new[]
            {
                "Microsoft Word - ",
                "Microsoft PowerPoint - ",
                "Microsoft Excel - "
            };

            var endReplacements = new[]
            {
                ".xps",
                ".xml",
                ".xltx",
                ".xltm",
                ".xlt",
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".xls",
                ".xlam",
                ".xla",
                ".wmf",
                ".txt - Editor",
                ".txt",
                ".tiff",
                ".tif",
                ".thmx",
                ".slk",
                ".rtf",
                ".prn",
                ".pptx",
                ".pptm",
                ".ppt",
                ".ppsx",
                ".ppsm",
                ".pps",
                ".ppam",
                ".ppa",
                ".potx",
                ".potm",
                ".pot",
                ".png",
                ".pdf",
                ".odt",
                ".ods",
                ".odp",
                ".mhtml",
                ".mht",
                ".jpg",
                ".jpeg",
                ".html",
                ".htm",
                ".emf",
                ".dotx",
                ".dotm",
                ".dot",
                ".docx",
                ".docm",
                ".doc",
                ".dif",
                ".csv",
                ".bmp",
                " - Editor"
            };

            var titleReplacement = new List <TitleReplacement>();

            foreach (var replacement in startReplacements)
            {
                titleReplacement.Add(new TitleReplacement(ReplacementType.Start, replacement, ""));
            }

            foreach (var replacement in endReplacements)
            {
                titleReplacement.Add(new TitleReplacement(ReplacementType.End, replacement, ""));
            }

            settings.ApplicationSettings.TitleReplacement = titleReplacement;

            string language = FindDefaultLanguage();
            if (language != null)
            {
                settings.ApplicationSettings.Language = language;
            }

            settings.SortConversionProfiles();

            if (string.IsNullOrWhiteSpace(settings.ApplicationSettings.LastUsedProfileGuid))
            {
                settings.ApplicationSettings.LastUsedProfileGuid = ProfileGuids.DEFAULT_PROFILE_GUID;
            }

            settings.ApplicationProperties.SettingsVersion = SETTINGS_VERSION;

            return(settings);
        }