示例#1
0
        /* ----------------------------------------------------------------- */
        ///
        /// InvokeLinearization
        ///
        /// <summary>
        /// Invokes the linearization on the specified PDF file.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void InvokeLinearization(string src)
        {
            if (!Value.Linearization || Value.Encryption.Enabled)
            {
                return;
            }

            var tmp = IO.Combine(IO.Get(src).DirectoryName, Guid.NewGuid().ToString("D"));
            var gs  = GhostscriptFactory.Create(Settings);

            if (gs is PdfConverter pdf)
            {
                pdf.Linearization = Value.Linearization;
                pdf.Invoke(src, tmp);
                IO.Move(tmp, src, true);
            }
        }
示例#2
0
        /* ----------------------------------------------------------------- */
        ///
        /// InvokeLinearization
        ///
        /// <summary>
        /// Invokes the linearization on the specified PDF file.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void InvokeLinearization(string src)
        {
            var value = Settings.Value;

            if (!value.Linearization || value.Encryption.Enabled)
            {
                return;
            }

            if (GhostscriptFactory.Create(Settings) is PdfConverter gs)
            {
                var tmp = GetTemp(src);
                gs.Linearization = value.Linearization;
                gs.Invoke(src, tmp);
                Settings.IO.MoveOrCopy(tmp, src, true);
            }
        }
示例#3
0
        /* ----------------------------------------------------------------- */
        ///
        /// InvokeLinearization
        ///
        /// <summary>
        /// Invokes the linearization on the specified PDF file.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void InvokeLinearization(string src)
        {
            var io    = Settings.IO;
            var value = Settings.Value;

            if (!value.Linearization || value.Encryption.Enabled)
            {
                return;
            }

            if (GhostscriptFactory.Create(Settings) is PdfConverter gs)
            {
                var tmp = io.Combine(io.Get(src).DirectoryName, Guid.NewGuid().ToString("D"));
                gs.Linearization = value.Linearization;
                gs.Invoke(src, tmp);
                io.Move(tmp, src, true);
            }
        }
示例#4
0
 /* ----------------------------------------------------------------- */
 ///
 /// RunGhostscript
 ///
 /// <summary>
 /// Invokes the Ghostscript API.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private void RunGhostscript(string dest) => Run(() =>
 {
     var gs = GhostscriptFactory.Create(Settings);
     try { gs.Invoke(Settings.Value.Source, dest); }
     finally { gs.LogDebug(); }
 });