Ejemplo n.º 1
1
        /// <summary>
        /// Returns an array of arguments to be sent to the Ghostscript API
        /// </summary>
        /// <param name="inputPath">Path to the source file</param>
        /// <param name="outputPath">Path to the output file</param>
        /// <param name="firstPage">The page of the file to start on</param>
        /// <param name="lastPage">The page of the file to end on</param>
        private static string[] GetArgs(string inputPath,
                                        string outputPath,
                                        int firstPage,
                                        int lastPage,
                                        int dpix,
                                        int dpiy,
                                        int width,
                                        int height)
        {
            // To maintain backwards compatibility, this method uses previous hardcoded values.

            GhostscriptSettings s = new GhostscriptSettings();

            s.Device     = Settings.GhostscriptDevices.jpeg;
            s.Page.Start = firstPage;
            s.Page.End   = lastPage;
            s.Resolution = new System.Drawing.Size(dpix, dpiy);

            Settings.GhostscriptPageSize pageSize = new Settings.GhostscriptPageSize();
            if (width == 0 && height == 0)
            {
                pageSize.Native = GhostscriptSharp.Settings.GhostscriptPageSizes.a7;
            }
            else
            {
                pageSize.Manual = new Size(width, height);
            }
            s.Size = pageSize;

            return(GetArgs(inputPath, outputPath, s));
        }
        /// <summary>
        /// Returns an array of arguments to be sent to the Ghostscript API
        /// </summary>
        /// <param name="inputPath">Path to the source file</param>
        /// <param name="outputPath">Path to the output file</param>
        /// <param name="firstPage">The page of the file to start on</param>
        /// <param name="lastPage">The page of the file to end on</param>
        private static string[] GetArgs(string inputPath, string outputPath, int firstPage, int lastPage, int dpix, int dpiy, int width, int height)
        {
            // To maintain backwards compatibility, this method uses previous hardcoded values.
            GhostscriptSettings s = new GhostscriptSettings();
            s.Device = GhostscriptDevices.jpeg;
            s.Pages.Start = firstPage;
            s.Pages.End = lastPage;
            s.Resolution = new System.Drawing.Size(dpix, dpiy);

            GhostscriptPageSize pageSize = new GhostscriptPageSize();
            if (width == 0 && height == 0)
            {
                pageSize.Native = GhostscriptPageSizes.a7;
            }
            else
            {
                pageSize.Manual = new Size(width, height);
            }
            s.Size = pageSize;

            return GetArgs(inputPath, outputPath, s);
        }
        /// <summary>
        /// Returns an array of arguments to be sent to the Ghostscript API
        /// </summary>
        /// <param name="inputPath">Path to the source file</param>
        /// <param name="outputPath">Path to the output file</param>
        /// <param name="firstPage">The page of the file to start on</param>
        /// <param name="lastPage">The page of the file to end on</param>
        private static string[] GetArgs(string inputPath,
			string outputPath,
			int firstPage,
			int lastPage,
			int width,
			int height)
        {
            // To maintain backwards compatibility, this method uses previous hardcoded values.

            GhostscriptSettings s = new GhostscriptSettings();
            s.Device = Settings.GhostscriptDevices.jpeg;
            s.Page.Start = firstPage;
            s.Page.End = lastPage;
            s.Resolution = new System.Drawing.Size(width, height);

            Settings.GhostscriptPageSize pageSize = new Settings.GhostscriptPageSize();
            pageSize.Native = GhostscriptSharp.Settings.GhostscriptPageSizes.a7;
            s.Size = pageSize;

            return GetArgs(inputPath, outputPath, s);
        }
 public GhostscriptSettings()
 {
     Size = new Settings.GhostscriptPageSize();
     Page = new Settings.GhostscriptPages();
 }