Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Pdf.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.Pdf.Test
Commits
9296f369
Commit
9296f369
authored
Jun 22, 2020
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7051bb21
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
8 deletions
+134
-8
frmMain.Designer.cs
frmMain.Designer.cs
+126
-4
frmMain.cs
frmMain.cs
+8
-4
No files found.
frmMain.Designer.cs
View file @
9296f369
...
@@ -75,14 +75,25 @@
...
@@ -75,14 +75,25 @@
this
.
btnSelectPfx
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnSelectPfx
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
tbxOffsetY
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbxOffsetY
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
btnSelectFile
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnSelectFile
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
button2
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label24
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
textBox2
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label25
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label26
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
button3
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
textBox3
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
button4
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label27
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
panel1
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// button1
// button1
//
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
10
59
,
109
);
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
10
35
,
493
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
TabIndex
=
0
;
...
@@ -91,7 +102,7 @@
...
@@ -91,7 +102,7 @@
//
//
// textBox1
// textBox1
//
//
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
888
,
41
);
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
1021
,
372
);
this
.
textBox1
.
Name
=
"textBox1"
;
this
.
textBox1
.
Name
=
"textBox1"
;
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
21
);
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
21
);
this
.
textBox1
.
TabIndex
=
2
;
this
.
textBox1
.
TabIndex
=
2
;
...
@@ -99,7 +110,7 @@
...
@@ -99,7 +110,7 @@
// label2
// label2
//
//
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
805
,
45
);
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
938
,
376
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
59
,
12
);
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
59
,
12
);
this
.
label2
.
TabIndex
=
3
;
this
.
label2
.
TabIndex
=
3
;
...
@@ -210,7 +221,7 @@
...
@@ -210,7 +221,7 @@
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
441
,
475
);
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
441
,
475
);
this
.
groupBox1
.
TabIndex
=
12
;
this
.
groupBox1
.
TabIndex
=
12
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"操作参数"
;
this
.
groupBox1
.
Text
=
"
单功能
操作参数"
;
//
//
// label20
// label20
//
//
...
@@ -536,11 +547,110 @@
...
@@ -536,11 +547,110 @@
this
.
btnSelectFile
.
UseVisualStyleBackColor
=
true
;
this
.
btnSelectFile
.
UseVisualStyleBackColor
=
true
;
this
.
btnSelectFile
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectFile_Click
);
this
.
btnSelectFile
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectFile_Click
);
//
//
// groupBox3
//
this
.
groupBox3
.
Controls
.
Add
(
this
.
label27
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
button4
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
textBox2
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
textBox3
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
button3
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
button2
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
label26
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
label24
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
label25
);
this
.
groupBox3
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Left
;
this
.
groupBox3
.
Location
=
new
System
.
Drawing
.
Point
(
441
,
0
);
this
.
groupBox3
.
Name
=
"groupBox3"
;
this
.
groupBox3
.
Size
=
new
System
.
Drawing
.
Size
(
366
,
657
);
this
.
groupBox3
.
TabIndex
=
13
;
this
.
groupBox3
.
TabStop
=
false
;
this
.
groupBox3
.
Text
=
"组合功能操作"
;
//
// button2
//
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
317
,
30
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
32
,
23
);
this
.
button2
.
TabIndex
=
5
;
this
.
button2
.
Text
=
"..."
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
this
.
button2
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectFile_Click
);
//
// label24
//
this
.
label24
.
AutoSize
=
true
;
this
.
label24
.
Location
=
new
System
.
Drawing
.
Point
(
81
,
54
);
this
.
label24
.
Name
=
"label24"
;
this
.
label24
.
Size
=
new
System
.
Drawing
.
Size
(
161
,
12
);
this
.
label24
.
TabIndex
=
6
;
this
.
label24
.
Text
=
"可以选择文件或填写Http地址"
;
//
// textBox2
//
this
.
textBox2
.
Location
=
new
System
.
Drawing
.
Point
(
83
,
30
);
this
.
textBox2
.
Name
=
"textBox2"
;
this
.
textBox2
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
21
);
this
.
textBox2
.
TabIndex
=
4
;
//
// label25
//
this
.
label25
.
AutoSize
=
true
;
this
.
label25
.
Location
=
new
System
.
Drawing
.
Point
(
18
,
33
);
this
.
label25
.
Name
=
"label25"
;
this
.
label25
.
Size
=
new
System
.
Drawing
.
Size
(
47
,
12
);
this
.
label25
.
TabIndex
=
1
;
this
.
label25
.
Text
=
"PDF路径"
;
//
// label26
//
this
.
label26
.
AutoSize
=
true
;
this
.
label26
.
Location
=
new
System
.
Drawing
.
Point
(
18
,
185
);
this
.
label26
.
Name
=
"label26"
;
this
.
label26
.
Size
=
new
System
.
Drawing
.
Size
(
53
,
12
);
this
.
label26
.
TabIndex
=
1
;
this
.
label26
.
Text
=
"保存路径"
;
//
// button3
//
this
.
button3
.
Location
=
new
System
.
Drawing
.
Point
(
317
,
182
);
this
.
button3
.
Name
=
"button3"
;
this
.
button3
.
Size
=
new
System
.
Drawing
.
Size
(
32
,
23
);
this
.
button3
.
TabIndex
=
5
;
this
.
button3
.
Text
=
"..."
;
this
.
button3
.
UseVisualStyleBackColor
=
true
;
this
.
button3
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectSaveFolder_Click
);
//
// textBox3
//
this
.
textBox3
.
Location
=
new
System
.
Drawing
.
Point
(
83
,
182
);
this
.
textBox3
.
Name
=
"textBox3"
;
this
.
textBox3
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
21
);
this
.
textBox3
.
TabIndex
=
4
;
//
// button4
//
this
.
button4
.
Location
=
new
System
.
Drawing
.
Point
(
20
,
227
);
this
.
button4
.
Name
=
"button4"
;
this
.
button4
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button4
.
TabIndex
=
6
;
this
.
button4
.
Text
=
"执行"
;
this
.
button4
.
UseVisualStyleBackColor
=
true
;
this
.
button4
.
Click
+=
new
System
.
EventHandler
(
this
.
btnStamp_Click
);
//
// label27
//
this
.
label27
.
Location
=
new
System
.
Drawing
.
Point
(
18
,
90
);
this
.
label27
.
Name
=
"label27"
;
this
.
label27
.
Size
=
new
System
.
Drawing
.
Size
(
331
,
60
);
this
.
label27
.
TabIndex
=
7
;
this
.
label27
.
Text
=
"执行过程参数以数组形式写在代码中,请参考代码,对文件进行组合操作"
;
//
// frmMain
// frmMain
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1185
,
657
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1185
,
657
);
this
.
Controls
.
Add
(
this
.
groupBox3
);
this
.
Controls
.
Add
(
this
.
panel1
);
this
.
Controls
.
Add
(
this
.
panel1
);
this
.
Controls
.
Add
(
this
.
label2
);
this
.
Controls
.
Add
(
this
.
label2
);
this
.
Controls
.
Add
(
this
.
textBox1
);
this
.
Controls
.
Add
(
this
.
textBox1
);
...
@@ -552,6 +662,8 @@
...
@@ -552,6 +662,8 @@
this
.
groupBox2
.
PerformLayout
();
this
.
groupBox2
.
PerformLayout
();
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
PerformLayout
();
this
.
groupBox1
.
PerformLayout
();
this
.
groupBox3
.
ResumeLayout
(
false
);
this
.
groupBox3
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
this
.
PerformLayout
();
...
@@ -606,6 +718,16 @@
...
@@ -606,6 +718,16 @@
private
System
.
Windows
.
Forms
.
TextBox
tbxSaveFolder
;
private
System
.
Windows
.
Forms
.
TextBox
tbxSaveFolder
;
private
System
.
Windows
.
Forms
.
Button
btnSelectSaveFolder
;
private
System
.
Windows
.
Forms
.
Button
btnSelectSaveFolder
;
private
System
.
Windows
.
Forms
.
Label
label23
;
private
System
.
Windows
.
Forms
.
Label
label23
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox3
;
private
System
.
Windows
.
Forms
.
Label
label27
;
private
System
.
Windows
.
Forms
.
Button
button4
;
private
System
.
Windows
.
Forms
.
TextBox
textBox2
;
private
System
.
Windows
.
Forms
.
TextBox
textBox3
;
private
System
.
Windows
.
Forms
.
Button
button3
;
private
System
.
Windows
.
Forms
.
Button
button2
;
private
System
.
Windows
.
Forms
.
Label
label26
;
private
System
.
Windows
.
Forms
.
Label
label24
;
private
System
.
Windows
.
Forms
.
Label
label25
;
}
}
}
}
frmMain.cs
View file @
9296f369
...
@@ -85,6 +85,8 @@ namespace Kivii.Pdf.Test
...
@@ -85,6 +85,8 @@ namespace Kivii.Pdf.Test
return
;
return
;
}
}
PdfReader
reader
=
null
;
PdfReader
reader
=
null
;
try
{
if
(
tbxPdfFilePath
.
Text
.
StartsWith
(
"http"
,
StringComparison
.
CurrentCultureIgnoreCase
))
if
(
tbxPdfFilePath
.
Text
.
StartsWith
(
"http"
,
StringComparison
.
CurrentCultureIgnoreCase
))
{
{
reader
=
new
PdfReader
(
new
Uri
(
tbxPdfFilePath
.
Text
));
reader
=
new
PdfReader
(
new
Uri
(
tbxPdfFilePath
.
Text
));
...
@@ -93,18 +95,20 @@ namespace Kivii.Pdf.Test
...
@@ -93,18 +95,20 @@ namespace Kivii.Pdf.Test
{
{
reader
=
new
PdfReader
(
tbxPdfFilePath
.
Text
);
reader
=
new
PdfReader
(
tbxPdfFilePath
.
Text
);
}
}
try
{
var
saveFilePath
=
System
.
IO
.
Path
.
Combine
(
tbxSaveFolder
.
Text
,
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
tbxPdfFilePath
.
Text
)
+
"_"
+
setting
.
StampType
.
ToString
()
+
".pdf"
);
var
saveFilePath
=
System
.
IO
.
Path
.
Combine
(
tbxSaveFolder
.
Text
,
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
tbxPdfFilePath
.
Text
)
+
"_"
+
setting
.
StampType
.
ToString
()
+
".pdf"
);
if
(
System
.
IO
.
File
.
Exists
(
saveFilePath
))
System
.
IO
.
File
.
Delete
(
saveFilePath
);
if
(
System
.
IO
.
File
.
Exists
(
saveFilePath
))
System
.
IO
.
File
.
Delete
(
saveFilePath
);
var
result
=
reader
.
Stamp
(
setting
,
saveFilePath
);
var
result
=
reader
.
Stamp
(
setting
,
saveFilePath
);
reader
.
Close
();
MessageBox
.
Show
(
$"操作结果:
{
result
}
"
);
MessageBox
.
Show
(
$"操作结果:
{
result
}
"
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
MessageBox
.
Show
(
$"发生错误:
{
ex
.
Message
}
"
);
MessageBox
.
Show
(
$"发生错误:
{
ex
.
Message
}
"
);
}
}
finally
{
reader
?.
Close
();
}
}
}
}
}
}
}
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