Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.GhostScript.Test
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
示例代码
Kivii.GhostScript.Test
Commits
cdb44235
Commit
cdb44235
authored
Oct 17, 2020
by
leo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
392f8815
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
237 deletions
+35
-237
Form1.Designer.cs
Form1.Designer.cs
+0
-220
FrmMain.Designer.cs
FrmMain.Designer.cs
+0
-0
FrmMain.cs
FrmMain.cs
+25
-8
FrmMain.resx
FrmMain.resx
+0
-0
Kivii.GhostScript.Test.csproj
Kivii.GhostScript.Test.csproj
+7
-7
Program.cs
Program.cs
+1
-1
packages.config
packages.config
+2
-1
No files found.
Form1.Designer.cs
deleted
100644 → 0
View file @
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
;
}
}
FrmMain.Designer.cs
0 → 100644
View file @
cdb44235
This diff is collapsed.
Click to expand it.
F
orm1
.cs
→
F
rmMain
.cs
View file @
cdb44235
using
System
;
using
System
;
using
System.Diagnostics
;
using
System.Drawing.Printing
;
using
System.Drawing.Printing
;
using
System.IO
;
using
System.IO
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
namespace
Test
namespace
Test
{
{
public
partial
class
F
orm1
:
Form
public
partial
class
F
rmMain
:
Form
{
{
public
F
orm1
()
public
F
rmMain
()
{
{
InitializeComponent
();
InitializeComponent
();
}
}
...
@@ -40,22 +41,38 @@ namespace Test
...
@@ -40,22 +41,38 @@ namespace Test
private
void
btnExportImage_Click
(
object
sender
,
EventArgs
e
)
private
void
btnExportImage_Click
(
object
sender
,
EventArgs
e
)
{
{
Kivii
.
GhostScript
.
Tools
.
ToPng
(
tbxFileSource
.
Text
,
Path
.
Combine
(
tbxSaveFolder
.
Text
,
"%d.png"
));
btnExportImage
.
Enabled
=
false
;
cbxToPng
.
Text
=
"导出PNG"
;
Kivii
.
GhostScript
.
Tools
.
ToJpeg
(
tbxFileSource
.
Text
,
Path
.
Combine
(
tbxSaveFolder
.
Text
,
"%d.jpg"
));
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
)
private
void
btnPrint_Click
(
object
sender
,
EventArgs
e
)
{
{
//Kivii.GhostScript.Tools.ToPrinter(@"C:\Test\1.pdf", cbxPrinter.SelectedItem.ToString());
Kivii
.
GhostScript
.
Instance
.
ToPrinter
(
tbxFileSource
.
Text
,
cbxPrinter
.
SelectedItem
.
ToString
(),
(
int
)
nudPrintCopies
.
Value
,
tbxPages
.
Text
,
(
int
)
nudResolution
.
Value
);
Kivii
.
GhostScript
.
Tools
.
ToPrinter
(
tbxFileSource
.
Text
,
cbxPrinter
.
SelectedItem
.
ToString
());
}
}
private
void
btnRun_Click
(
object
sender
,
EventArgs
e
)
private
void
btnRun_Click
(
object
sender
,
EventArgs
e
)
{
{
btnRun
.
Enabled
=
false
;
btnRun
.
Enabled
=
false
;
btnRun
.
Text
=
"执行(RUN)"
;
btnRun
.
Text
=
"执行(RUN)"
;
btnRun
.
Text
=
"执行(RUN="
+
Kivii
.
GhostScript
.
Tools
.
Run
(
rtbArguments
.
Lines
)+
")"
;
btnRun
.
Text
=
"执行(RUN="
+
Kivii
.
GhostScript
.
Instance
.
Run
(
rtbArguments
.
Lines
)+
")"
;
btnRun
.
Enabled
=
true
;
btnRun
.
Enabled
=
true
;
}
}
}
}
...
...
F
orm1
.resx
→
F
rmMain
.resx
View file @
cdb44235
File moved
Kivii.GhostScript.Test.csproj
View file @
cdb44235
...
@@ -32,8 +32,8 @@
...
@@ -32,8 +32,8 @@
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"Kivii.GhostScript.V4.0, Version=5.5.2020.
711
0, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.GhostScript.V4.0, Version=5.5.2020.
1000
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.GhostScript.5.5.2020.
711
0\lib\net40\Kivii.GhostScript.V4.0.dll
</HintPath>
<HintPath>
packages\Kivii.GhostScript.5.5.2020.
1000
0\lib\net40\Kivii.GhostScript.V4.0.dll
</HintPath>
<Private>
True
</Private>
<Private>
True
</Private>
</Reference>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
...
@@ -48,16 +48,16 @@
...
@@ -48,16 +48,16 @@
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile
Include=
"F
orm1
.cs"
>
<Compile
Include=
"F
rmMain
.cs"
>
<SubType>
Form
</SubType>
<SubType>
Form
</SubType>
</Compile>
</Compile>
<Compile
Include=
"F
orm1
.Designer.cs"
>
<Compile
Include=
"F
rmMain
.Designer.cs"
>
<DependentUpon>
F
orm1
.cs
</DependentUpon>
<DependentUpon>
F
rmMain
.cs
</DependentUpon>
</Compile>
</Compile>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<EmbeddedResource
Include=
"F
orm1
.resx"
>
<EmbeddedResource
Include=
"F
rmMain
.resx"
>
<DependentUpon>
F
orm1
.cs
</DependentUpon>
<DependentUpon>
F
rmMain
.cs
</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<Generator>
ResXFileCodeGenerator
</Generator>
...
...
Program.cs
View file @
cdb44235
...
@@ -15,7 +15,7 @@ namespace Test
...
@@ -15,7 +15,7 @@ namespace Test
{
{
Application
.
EnableVisualStyles
();
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
Run
(
new
F
orm1
());
Application
.
Run
(
new
F
rmMain
());
}
}
}
}
}
}
packages.config
View file @
cdb44235
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"Kivii.GhostScript"
version
=
"5.5.2020.
711
0"
targetFramework
=
"net40"
/>
<
package
id
=
"Kivii.GhostScript"
version
=
"5.5.2020.
1000
0"
targetFramework
=
"net40"
/>
</
packages
>
</
packages
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment