Exemplo n.º 1
0
 public static GhostscriptManager GetInstance()
 {
     lock (resourceLock)
     {
         if (_instance == null)
         {
             _instance = new GhostscriptManager();
         }
         return(_instance);
     }
 }
 public static GhostscriptManager GetInstance()
 {
     lock (resourceLock)
     {
         if (_instance == null)
         {
             _instance = new GhostscriptManager();
         }
         return _instance;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Convert a postscript file to a pdf
        /// </summary>
        /// <param name="outputPath">The path to create the output file. Put '%d' the path to create multiple numbered files, one for each page</param>
        /// <param name="inputPaths">One or more input files</param>
        public static void PsToPdf(String outputPath, params String[] inputPaths)
        {
            GhostscriptManager gsm = GhostscriptManager.GetInstance();
            bool libraryLoaded     = (gsm.libraryHandle != IntPtr.Zero);

            if (!libraryLoaded)
            {
                gsm.LoadGhostscriptLibrary();
            }
            GhostscriptSettings oldSettings = gsm.Settings;

            gsm.settings               = new GhostscriptSettings();
            gsm.Settings.Device        = GhostscriptSharp.Settings.GhostscriptDevices.pdfwrite;
            gsm.Settings.Page.AllPages = true;
            gsm.Settings.Quiet         = true;
            gsm.DoConvert(outputPath, inputPaths);
            if (!libraryLoaded)
            {
                gsm.UnloadGhostscriptLibrary();
            }
            gsm.settings = oldSettings;
        }