Ejemplo n.º 1
0
        private void SetPdfXParameters(IList <string> parameters)
        {
            var shortenedTempPath = PathHelper.GetShortPathName(Job.JobTempFolder);

            parameters.Add("-dPDFX");

            Logger.Debug("Shortened Temppath from\r\n\"" + Job.JobTempFolder + "\"\r\nto\r\n\"" + shortenedTempPath + "\"");

            //Add ICC profile
            var iccFile = PathSafe.Combine(shortenedTempPath, "profile.icc");

            switch (Job.Profile.PdfSettings.ColorModel)
            {
            case ColorModel.Cmyk:
                FileWrap.WriteAllBytes(iccFile, GhostscriptResources.WebCoatedFOGRA28);
                break;

            case ColorModel.Gray:
                FileWrap.WriteAllBytes(iccFile, GhostscriptResources.ISOcoated_v2_grey1c_bas);
                break;
            }
            parameters.Add("-sOutputICCProfile=\"" + iccFile + "\"");

            //Set in pdf-X example, but is not documented in the distiller parameters

            var defFile = PathSafe.Combine(shortenedTempPath, "pdfx_def.ps");
            var sb      = new StringBuilder(GhostscriptResources.PdfxDefinition);

            sb.Replace("%/ICCProfile (ISO Coated sb.icc)", "/ICCProfile (" + EncodeGhostscriptParametersOctal(iccFile.Replace('\\', '/')) + ")");
            FileWrap.WriteAllText(defFile, sb.ToString());
            parameters.Add(defFile);
        }
Ejemplo n.º 2
0
        private void SetPdfAParameters(IList <string> parameters)
        {
            var shortenedTempPath = PathHelper.GetShortPathName(Job.JobTempFolder);

            switch (Job.Profile.OutputFormat)
            {
            case OutputFormat.PdfA1B:
                parameters.Add("-dPDFA=1");
                break;

            case OutputFormat.PdfA2B:
                parameters.Add("-dPDFA=2");
                break;

            case OutputFormat.PdfA3B:
                parameters.Add("-dPDFA=3");
                break;
            }

            //parameters.Add("-dNOOUTERSAVE"); //Set in pdf-A example, but is not documented in the distiller parameters

            Logger.Debug("Shortened Temppath from\r\n\"" + Job.JobTempFolder + "\"\r\nto\r\n\"" + shortenedTempPath + "\"");

            //Add ICC profile
            var iccFile = PathSafe.Combine(shortenedTempPath, "profile.icc");

            //Set ICC Profile according to the color model
            switch (Job.Profile.PdfSettings.ColorModel)
            {
            case ColorModel.Cmyk:
                FileWrap.WriteAllBytes(iccFile, Resources.WebCoatedFOGRA28);
                break;

            case ColorModel.Gray:
                FileWrap.WriteAllBytes(iccFile, Resources.ISOcoated_v2_grey1c_bas);
                break;

            default:
            case ColorModel.Rgb:
                FileWrap.WriteAllBytes(iccFile, Resources.eciRGB_v2);
                break;
            }

            parameters.Add("-sPDFACompatibilityPolicy=1");

            parameters.Add("-sOutputICCProfile=\"" + iccFile + "\"");

            var defFile = PathSafe.Combine(Job.JobTempFolder, "pdfa_def.ps");
            var sb      = new StringBuilder(Resources.PdfaDefinition);

            sb.Replace("[ICC_PROFILE]", "(" + EncodeGhostscriptParametersOctal(iccFile.Replace('\\', '/')) + ")");
            FileWrap.WriteAllText(defFile, sb.ToString());
            parameters.Add(defFile);
        }
Ejemplo n.º 3
0
        private void SetPdfXParameters(IList <string> parameters)
        {
            var shortenedTempPath = PathHelper.GetShortPathName(Job.JobTempFolder);

            parameters.Add("-dPDFX");

            Logger.Debug("Shortened Temppath from\r\n\"" + Job.JobTempFolder + "\"\r\nto\r\n\"" + shortenedTempPath + "\"");

            //Add ICC profile
            string iccFile = PathSafe.Combine(shortenedTempPath, "profile.icc");

            FileWrap.WriteAllBytes(iccFile, CoreResources.ISOcoated_v2_300_eci);
            parameters.Add("-sOutputICCProfile=\"" + iccFile + "\"");
            //parameters.Add("-dNOOUTERSAVE"); //Set in pdf-X example, but is not documented in the distiller parameters

            string defFile = PathSafe.Combine(shortenedTempPath, "pdfx_def.ps");
            var    sb      = new StringBuilder(CoreResources.PdfxDefinition);

            sb.Replace("%/ICCProfile (ISO Coated sb.icc)", "/ICCProfile (" + EncodeGhostscriptParametersOctal(iccFile.Replace('\\', '/')) + ")");
            FileWrap.WriteAllText(defFile, sb.ToString());
            parameters.Add(defFile);
        }