/// <summary>
 /// Check Version number of Ghostscript.
 /// </summary>
 /// <param name="intRevision"></param>
 /// <returns></returns>
 public bool CheckVersion(int iVersion)
 {
     bool bCheckVersion = false;
     try
     {
         gsapi_revision_t udtGSRevInfo = new gsapi_revision_t();
         gsapi_revision(ref udtGSRevInfo, 16);
         if (udtGSRevInfo.revision == iVersion)
             bCheckVersion = true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return bCheckVersion;
 }
Example #2
0
 public static extern int gsapi_revision([In, Out] gsapi_revision_t revision, int len);
Example #3
0
        public GhostScript(string libraryPath)
        {
            // Check Library Path contains GhostScript DLL
            if (!File.Exists(Path.Combine(libraryPath, GSDLL32)))
            {
                System.Diagnostics.Debug.WriteLine("GhostScriptDllNotFound Exception raised");
                throw (new GhostScriptException((int)ReturnCode.GhostScriptDllNotFound, GetGSErrorMessage((int)ReturnCode.GhostScriptDllNotFound)));
            }

            // Get the GhostScript Version Info
            // Note: This also checks that the GhostScript DLL is available
            _VersionInfo = GetVersion();
            System.Diagnostics.Debug.WriteLine("GhostScript Revision = " + _VersionInfo.Revision.ToString());

            InitializePrivateMembers();

            _Handle = LoadLibrary(Path.Combine(libraryPath, "gsdll32.dll"));
            System.Diagnostics.Debug.WriteLine("GhostScript Handle = " + _Handle.ToString());
        }
Example #4
0
 public gsapi_revision_t GetVersion()
 {
     try
     {
         gsapi_revision_t revisionInfo = new gsapi_revision_t();
         gsapi_revision(revisionInfo, Marshal.SizeOf(revisionInfo));
         return revisionInfo;
     }
     catch (System.DllNotFoundException)
     {
         throw (new GhostScriptException((int)ReturnCode.UnableToLoadGhostScriptDll, GetGSErrorMessage((int)ReturnCode.UnableToLoadGhostScriptDll)));
     }
 }
 private static extern int gsapi_revision(/*[In, Out]*/ ref gsapi_revision_t revision, int len);
 /// <summary>
 /// Get and display Version details of Ghostscript.
 /// </summary>
 /// <param name="intRevision"></param>
 /// <returns></returns>
 public void GetVersion()
 {
     try
     {
         gsapi_revision_t udtGSRevInfo = new gsapi_revision_t();
         gsapi_revision(ref udtGSRevInfo, 16);
         MessageBox.Show("Revision = " + udtGSRevInfo.revision.ToString() + "\n" +
             "RevisionDate = " + udtGSRevInfo.revisiondate.ToString() + "\n" +
             "Product = " + udtGSRevInfo.product + "\n" +
             "Copyright = " + udtGSRevInfo.copyright,
             "Ghostscript",
             MessageBoxButtons.OK,
             MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }