Commit cdb44235 by leo

更新代码

parent 392f8815
namespace Test
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnExportImage = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tbxFileSource = new System.Windows.Forms.TextBox();
this.btnSelectFile = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.tbxSaveFolder = new System.Windows.Forms.TextBox();
this.btnSelectSaveFolder = new System.Windows.Forms.Button();
this.btnPrint = new System.Windows.Forms.Button();
this.cbxPrinter = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.btnRun = new System.Windows.Forms.Button();
this.rtbArguments = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnExportImage
//
this.btnExportImage.Location = new System.Drawing.Point(424, 110);
this.btnExportImage.Name = "btnExportImage";
this.btnExportImage.Size = new System.Drawing.Size(114, 23);
this.btnExportImage.TabIndex = 0;
this.btnExportImage.Text = "导出图片";
this.btnExportImage.UseVisualStyleBackColor = true;
this.btnExportImage.Click += new System.EventHandler(this.btnExportImage_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(-1, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(137, 12);
this.label1.TabIndex = 1;
this.label1.Text = "选择源文件(不支持中文)";
//
// tbxFileSource
//
this.tbxFileSource.Location = new System.Drawing.Point(152, 25);
this.tbxFileSource.Name = "tbxFileSource";
this.tbxFileSource.Size = new System.Drawing.Size(340, 21);
this.tbxFileSource.TabIndex = 2;
//
// btnSelectFile
//
this.btnSelectFile.Location = new System.Drawing.Point(498, 25);
this.btnSelectFile.Name = "btnSelectFile";
this.btnSelectFile.Size = new System.Drawing.Size(40, 23);
this.btnSelectFile.TabIndex = 3;
this.btnSelectFile.Text = "...";
this.btnSelectFile.UseVisualStyleBackColor = true;
this.btnSelectFile.Click += new System.EventHandler(this.btnSelectFile_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(-1, 75);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(149, 12);
this.label2.TabIndex = 4;
this.label2.Text = "选择导出目录(不支持中文)";
//
// tbxSaveFolder
//
this.tbxSaveFolder.Location = new System.Drawing.Point(150, 70);
this.tbxSaveFolder.Name = "tbxSaveFolder";
this.tbxSaveFolder.Size = new System.Drawing.Size(340, 21);
this.tbxSaveFolder.TabIndex = 5;
//
// btnSelectSaveFolder
//
this.btnSelectSaveFolder.Location = new System.Drawing.Point(498, 70);
this.btnSelectSaveFolder.Name = "btnSelectSaveFolder";
this.btnSelectSaveFolder.Size = new System.Drawing.Size(40, 23);
this.btnSelectSaveFolder.TabIndex = 6;
this.btnSelectSaveFolder.Text = "...";
this.btnSelectSaveFolder.UseVisualStyleBackColor = true;
this.btnSelectSaveFolder.Click += new System.EventHandler(this.btnSelectSaveFolder_Click);
//
// btnPrint
//
this.btnPrint.Location = new System.Drawing.Point(331, 110);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(75, 23);
this.btnPrint.TabIndex = 7;
this.btnPrint.Text = "打印";
this.btnPrint.UseVisualStyleBackColor = true;
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// cbxPrinter
//
this.cbxPrinter.FormattingEnabled = true;
this.cbxPrinter.Location = new System.Drawing.Point(150, 110);
this.cbxPrinter.Name = "cbxPrinter";
this.cbxPrinter.Size = new System.Drawing.Size(155, 20);
this.cbxPrinter.TabIndex = 8;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 113);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 4;
this.label3.Text = "选择打印机";
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(465, 179);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 63);
this.btnRun.TabIndex = 9;
this.btnRun.Text = "执行(RUN)";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// rtbArguments
//
this.rtbArguments.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.rtbArguments.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbArguments.Location = new System.Drawing.Point(3, 17);
this.rtbArguments.Name = "rtbArguments";
this.rtbArguments.Size = new System.Drawing.Size(420, 300);
this.rtbArguments.TabIndex = 10;
this.rtbArguments.Text = "-dQUIET\n-dPARANOIDSAFER\n-dBATCH\n-dNOPAUSE\n-dNOPROMPT\n-sDEVICE=";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rtbArguments);
this.groupBox1.Location = new System.Drawing.Point(14, 162);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(426, 320);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "通过参数执行GhostScript";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(17, 139);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(340, 21);
this.textBox1.TabIndex = 5;
this.textBox1.Text = "https://www.ghostscript.com/documentation.html";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(548, 494);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnRun);
this.Controls.Add(this.cbxPrinter);
this.Controls.Add(this.btnPrint);
this.Controls.Add(this.btnSelectSaveFolder);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.tbxSaveFolder);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnSelectFile);
this.Controls.Add(this.tbxFileSource);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnExportImage);
this.Name = "Form1";
this.Text = "PDF文件扩展功能";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnExportImage;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbxFileSource;
private System.Windows.Forms.Button btnSelectFile;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbxSaveFolder;
private System.Windows.Forms.Button btnSelectSaveFolder;
private System.Windows.Forms.Button btnPrint;
private System.Windows.Forms.ComboBox cbxPrinter;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.RichTextBox rtbArguments;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox1;
}
}
namespace Test
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnExportImage = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tbxFileSource = new System.Windows.Forms.TextBox();
this.btnSelectFile = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.tbxSaveFolder = new System.Windows.Forms.TextBox();
this.btnSelectSaveFolder = new System.Windows.Forms.Button();
this.btnPrint = new System.Windows.Forms.Button();
this.cbxPrinter = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.btnRun = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.nudPrintCopies = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
this.tbxPages = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.rtbArguments = new System.Windows.Forms.RichTextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.lnkDocumentUrl = new System.Windows.Forms.LinkLabel();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.cbxToJpeg = new System.Windows.Forms.CheckBox();
this.cbxToPng = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.nudResolution = new System.Windows.Forms.NumericUpDown();
this.nudThreads = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.nudPrintCopies)).BeginInit();
this.panel1.SuspendLayout();
this.groupBox5.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudResolution)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudThreads)).BeginInit();
this.SuspendLayout();
//
// btnExportImage
//
this.btnExportImage.Location = new System.Drawing.Point(329, 54);
this.btnExportImage.Name = "btnExportImage";
this.btnExportImage.Size = new System.Drawing.Size(76, 35);
this.btnExportImage.TabIndex = 0;
this.btnExportImage.Text = "导出图片";
this.btnExportImage.UseVisualStyleBackColor = true;
this.btnExportImage.Click += new System.EventHandler(this.btnExportImage_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 29);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 1;
this.label1.Text = "选择文件";
//
// tbxFileSource
//
this.tbxFileSource.Location = new System.Drawing.Point(74, 24);
this.tbxFileSource.Name = "tbxFileSource";
this.tbxFileSource.Size = new System.Drawing.Size(283, 21);
this.tbxFileSource.TabIndex = 2;
//
// btnSelectFile
//
this.btnSelectFile.Location = new System.Drawing.Point(363, 24);
this.btnSelectFile.Name = "btnSelectFile";
this.btnSelectFile.Size = new System.Drawing.Size(40, 23);
this.btnSelectFile.TabIndex = 3;
this.btnSelectFile.Text = "...";
this.btnSelectFile.UseVisualStyleBackColor = true;
this.btnSelectFile.Click += new System.EventHandler(this.btnSelectFile_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 25);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 4;
this.label2.Text = "导出目录";
//
// tbxSaveFolder
//
this.tbxSaveFolder.Location = new System.Drawing.Point(72, 22);
this.tbxSaveFolder.Name = "tbxSaveFolder";
this.tbxSaveFolder.Size = new System.Drawing.Size(284, 21);
this.tbxSaveFolder.TabIndex = 5;
//
// btnSelectSaveFolder
//
this.btnSelectSaveFolder.Location = new System.Drawing.Point(365, 22);
this.btnSelectSaveFolder.Name = "btnSelectSaveFolder";
this.btnSelectSaveFolder.Size = new System.Drawing.Size(40, 23);
this.btnSelectSaveFolder.TabIndex = 6;
this.btnSelectSaveFolder.Text = "...";
this.btnSelectSaveFolder.UseVisualStyleBackColor = true;
this.btnSelectSaveFolder.Click += new System.EventHandler(this.btnSelectSaveFolder_Click);
//
// btnPrint
//
this.btnPrint.Location = new System.Drawing.Point(344, 50);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(75, 23);
this.btnPrint.TabIndex = 7;
this.btnPrint.Text = "打印";
this.btnPrint.UseVisualStyleBackColor = true;
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// cbxPrinter
//
this.cbxPrinter.FormattingEnabled = true;
this.cbxPrinter.Location = new System.Drawing.Point(73, 20);
this.cbxPrinter.Name = "cbxPrinter";
this.cbxPrinter.Size = new System.Drawing.Size(165, 20);
this.cbxPrinter.TabIndex = 8;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(15, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 12);
this.label3.TabIndex = 4;
this.label3.Text = "选择打印";
//
// btnRun
//
this.btnRun.Dock = System.Windows.Forms.DockStyle.Right;
this.btnRun.Location = new System.Drawing.Point(344, 0);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 24);
this.btnRun.TabIndex = 9;
this.btnRun.Text = "执行(RUN)";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(246, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 12);
this.label4.TabIndex = 12;
this.label4.Text = "选择份数";
//
// nudPrintCopies
//
this.nudPrintCopies.Location = new System.Drawing.Point(306, 19);
this.nudPrintCopies.Maximum = new decimal(new int[] {
5,
0,
0,
0});
this.nudPrintCopies.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudPrintCopies.Name = "nudPrintCopies";
this.nudPrintCopies.Size = new System.Drawing.Size(50, 21);
this.nudPrintCopies.TabIndex = 13;
this.nudPrintCopies.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(15, 57);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 12);
this.label5.TabIndex = 1;
this.label5.Text = "页码范围";
//
// tbxPages
//
this.tbxPages.Location = new System.Drawing.Point(74, 52);
this.tbxPages.Name = "tbxPages";
this.tbxPages.Size = new System.Drawing.Size(145, 21);
this.tbxPages.TabIndex = 2;
//
// panel1
//
this.panel1.Controls.Add(this.groupBox5);
this.panel1.Controls.Add(this.groupBox4);
this.panel1.Controls.Add(this.groupBox3);
this.panel1.Controls.Add(this.groupBox2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(425, 651);
this.panel1.TabIndex = 14;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.rtbArguments);
this.groupBox5.Controls.Add(this.panel2);
this.groupBox5.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox5.Location = new System.Drawing.Point(0, 271);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(425, 380);
this.groupBox5.TabIndex = 3;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "通过参数执行";
//
// rtbArguments
//
this.rtbArguments.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.rtbArguments.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbArguments.Location = new System.Drawing.Point(3, 17);
this.rtbArguments.Name = "rtbArguments";
this.rtbArguments.Size = new System.Drawing.Size(419, 336);
this.rtbArguments.TabIndex = 13;
this.rtbArguments.Text = "-dQUIET\n-dPARANOIDSAFER\n-dBATCH\n-dNOPAUSE\n-dNOPROMPT\n-sDEVICE=";
//
// panel2
//
this.panel2.Controls.Add(this.lnkDocumentUrl);
this.panel2.Controls.Add(this.btnRun);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(3, 353);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(419, 24);
this.panel2.TabIndex = 1;
//
// lnkDocumentUrl
//
this.lnkDocumentUrl.Dock = System.Windows.Forms.DockStyle.Left;
this.lnkDocumentUrl.Location = new System.Drawing.Point(0, 0);
this.lnkDocumentUrl.Name = "lnkDocumentUrl";
this.lnkDocumentUrl.Size = new System.Drawing.Size(281, 24);
this.lnkDocumentUrl.TabIndex = 1;
this.lnkDocumentUrl.TabStop = true;
this.lnkDocumentUrl.Text = "https://www.ghostscript.com/documentation.html";
this.lnkDocumentUrl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label3);
this.groupBox4.Controls.Add(this.nudPrintCopies);
this.groupBox4.Controls.Add(this.cbxPrinter);
this.groupBox4.Controls.Add(this.btnPrint);
this.groupBox4.Controls.Add(this.label4);
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox4.Location = new System.Drawing.Point(0, 189);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(425, 82);
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "打印输出";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.cbxToJpeg);
this.groupBox3.Controls.Add(this.cbxToPng);
this.groupBox3.Controls.Add(this.label2);
this.groupBox3.Controls.Add(this.tbxSaveFolder);
this.groupBox3.Controls.Add(this.btnSelectSaveFolder);
this.groupBox3.Controls.Add(this.btnExportImage);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox3.Location = new System.Drawing.Point(0, 83);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(425, 106);
this.groupBox3.TabIndex = 1;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "图片输出";
//
// cbxToJpeg
//
this.cbxToJpeg.AutoSize = true;
this.cbxToJpeg.Location = new System.Drawing.Point(17, 73);
this.cbxToJpeg.Name = "cbxToJpeg";
this.cbxToJpeg.Size = new System.Drawing.Size(72, 16);
this.cbxToJpeg.TabIndex = 12;
this.cbxToJpeg.Tag = "jpeg";
this.cbxToJpeg.Text = "导出JPEG";
this.cbxToJpeg.UseVisualStyleBackColor = true;
//
// cbxToPng
//
this.cbxToPng.AutoSize = true;
this.cbxToPng.Location = new System.Drawing.Point(17, 51);
this.cbxToPng.Name = "cbxToPng";
this.cbxToPng.Size = new System.Drawing.Size(66, 16);
this.cbxToPng.TabIndex = 11;
this.cbxToPng.Tag = "png16m";
this.cbxToPng.Text = "导出PNG";
this.cbxToPng.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.nudResolution);
this.groupBox2.Controls.Add(this.nudThreads);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.tbxFileSource);
this.groupBox2.Controls.Add(this.tbxPages);
this.groupBox2.Controls.Add(this.btnSelectFile);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(425, 83);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "基本设置";
//
// nudResolution
//
this.nudResolution.Location = new System.Drawing.Point(357, 53);
this.nudResolution.Maximum = new decimal(new int[] {
1200,
0,
0,
0});
this.nudResolution.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.nudResolution.Name = "nudResolution";
this.nudResolution.Size = new System.Drawing.Size(43, 21);
this.nudResolution.TabIndex = 15;
this.nudResolution.Value = new decimal(new int[] {
300,
0,
0,
0});
//
// nudThreads
//
this.nudThreads.Location = new System.Drawing.Point(268, 53);
this.nudThreads.Maximum = new decimal(new int[] {
5,
0,
0,
0});
this.nudThreads.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudThreads.Name = "nudThreads";
this.nudThreads.Size = new System.Drawing.Size(36, 21);
this.nudThreads.TabIndex = 15;
this.nudThreads.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(310, 57);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(41, 12);
this.label7.TabIndex = 14;
this.label7.Text = "分辨率";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(224, 58);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(41, 12);
this.label6.TabIndex = 14;
this.label6.Text = "线程数";
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(436, 651);
this.Controls.Add(this.panel1);
this.Name = "FrmMain";
this.Text = "PDF文件扩展功能";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.nudPrintCopies)).EndInit();
this.panel1.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudResolution)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudThreads)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnExportImage;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbxFileSource;
private System.Windows.Forms.Button btnSelectFile;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbxSaveFolder;
private System.Windows.Forms.Button btnSelectSaveFolder;
private System.Windows.Forms.Button btnPrint;
private System.Windows.Forms.ComboBox cbxPrinter;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.NumericUpDown nudPrintCopies;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox tbxPages;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.RichTextBox rtbArguments;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.LinkLabel lnkDocumentUrl;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox cbxToJpeg;
private System.Windows.Forms.CheckBox cbxToPng;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.NumericUpDown nudResolution;
private System.Windows.Forms.NumericUpDown nudThreads;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
}
}
using System;
using System.Diagnostics;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
namespace Test
{
public partial class Form1 : Form
public partial class FrmMain : Form
{
public Form1()
public FrmMain()
{
InitializeComponent();
}
......@@ -40,22 +41,38 @@ namespace Test
private void btnExportImage_Click(object sender, EventArgs e)
{
Kivii.GhostScript.Tools.ToPng(tbxFileSource.Text, Path.Combine(tbxSaveFolder.Text,"%d.png"));
Kivii.GhostScript.Tools.ToJpeg(tbxFileSource.Text, Path.Combine(tbxSaveFolder.Text, "%d.jpg"));
btnExportImage.Enabled = false;
cbxToPng.Text = "导出PNG";
cbxToJpeg.Text = "导出JPEG";
if (cbxToPng.Checked)
{
Stopwatch sw = new Stopwatch();
sw.Start();
var status = Kivii.GhostScript.Instance.ToPng(tbxFileSource.Text, Path.Combine(tbxSaveFolder.Text, "%d.png"),tbxPages.Text,(int)nudResolution.Value);
sw.Stop();
cbxToPng.Text = $"导出PNG,结果:{status},耗时{sw.Elapsed.TotalMilliseconds}毫秒";
}
if (cbxToJpeg.Checked)
{
Stopwatch sw = new Stopwatch();
sw.Start();
var status = Kivii.GhostScript.Instance.ToJpeg(tbxFileSource.Text, Path.Combine(tbxSaveFolder.Text, "%d.jpg"), tbxPages.Text, (int)nudResolution.Value);
sw.Stop();
cbxToJpeg.Text = $"导出JPEG,结果:{status},耗时{sw.Elapsed.TotalMilliseconds}毫秒";
}
btnExportImage.Enabled = true;
}
private void btnPrint_Click(object sender, EventArgs e)
{
//Kivii.GhostScript.Tools.ToPrinter(@"C:\Test\1.pdf", cbxPrinter.SelectedItem.ToString());
Kivii.GhostScript.Tools.ToPrinter(tbxFileSource.Text, cbxPrinter.SelectedItem.ToString());
Kivii.GhostScript.Instance.ToPrinter(tbxFileSource.Text, cbxPrinter.SelectedItem.ToString(), (int)nudPrintCopies.Value, tbxPages.Text, (int)nudResolution.Value);
}
private void btnRun_Click(object sender, EventArgs e)
{
btnRun.Enabled = false;
btnRun.Text = "执行(RUN)";
btnRun.Text="执行(RUN="+Kivii.GhostScript.Tools.Run(rtbArguments.Lines)+")";
btnRun.Text="执行(RUN="+Kivii.GhostScript.Instance.Run(rtbArguments.Lines)+")";
btnRun.Enabled = true;
}
}
......
......@@ -32,8 +32,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.GhostScript.V4.0, Version=5.5.2020.7110, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Kivii.GhostScript.5.5.2020.7110\lib\net40\Kivii.GhostScript.V4.0.dll</HintPath>
<Reference Include="Kivii.GhostScript.V4.0, Version=5.5.2020.10000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Kivii.GhostScript.5.5.2020.10000\lib\net40\Kivii.GhostScript.V4.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
......@@ -48,16 +48,16 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
......
......@@ -15,7 +15,7 @@ namespace Test
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new FrmMain());
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.GhostScript" version="5.5.2020.7110" targetFramework="net40" />
<package id="Kivii.GhostScript" version="5.5.2020.10000" targetFramework="net40" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment