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
8c790deb
Commit
8c790deb
authored
Jul 03, 2020
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
add1d346
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
16 deletions
+44
-16
Kivii.Pdf.Test.csproj
Kivii.Pdf.Test.csproj
+4
-4
StamperRequest.cs
StamperRequest.cs
+11
-1
frmMain.cs
frmMain.cs
+26
-9
packages.config
packages.config
+3
-2
No files found.
Kivii.Pdf.Test.csproj
View file @
8c790deb
...
...
@@ -32,12 +32,12 @@
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Kivii.Common.V4.0, Version=5.5.2020.
606
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.Common.5.5.2020.
606
0\lib\net40\Kivii.Common.V4.0.dll
</HintPath>
<Reference
Include=
"Kivii.Common.V4.0, Version=5.5.2020.
700
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.Common.5.5.2020.
700
0\lib\net40\Kivii.Common.V4.0.dll
</HintPath>
<Private>
True
</Private>
</Reference>
<Reference
Include=
"Kivii.Pdf.V4.0, Version=5.5.2020.
626
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.Pdf.5.5.2020.
626
0\lib\net40\Kivii.Pdf.V4.0.dll
</HintPath>
<Reference
Include=
"Kivii.Pdf.V4.0, Version=5.5.2020.
700
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.Pdf.5.5.2020.
700
0\lib\net40\Kivii.Pdf.V4.0.dll
</HintPath>
<Private>
True
</Private>
</Reference>
<Reference
Include=
"System"
/>
...
...
StamperRequest.cs
View file @
8c790deb
...
...
@@ -6,8 +6,18 @@ using System.Text;
namespace
Kivii.Pdf.Test
{
[
Route
(
"/Pdf/Stamper"
)]
public
class
StamperRequest
:
IReturn
<
object
>
public
class
StamperRequest
:
IReturn
<
StamperResponse
>
{
public
List
<
StampSetting
>
Settings
{
get
;
set
;
}
public
string
OpenFilePath
{
get
;
set
;
}
[
ApiMember
(
Description
=
"执行成功后保存的文件路径"
)]
public
string
SaveFilePath
{
get
;
set
;
}
}
public
class
StamperResponse
{
public
bool
Succeed
{
get
;
set
;
}
public
string
DownloadFilePath
{
get
;
set
;
}
}
}
frmMain.cs
View file @
8c790deb
...
...
@@ -187,15 +187,32 @@ namespace Kivii.Pdf.Test
private
void
btnStampByService_Click
(
object
sender
,
EventArgs
e
)
{
var
setting
=
getSetting
();
var
client
=
new
JsonServiceClient
(
tbxServiceUrl
.
Text
);
var
request
=
new
StamperRequest
();
request
.
Settings
=
new
List
<
StampSetting
>();
request
.
Settings
.
Add
(
setting
);
var
files
=
new
List
<
UploadFile
>();
files
.
Add
(
new
UploadFile
(
"A"
,
new
FileStream
(
tbxStampFilePath
.
Text
,
FileMode
.
Open
),
"StampFilePath"
));
var
rtns
=
client
.
PostFilesWithRequest
<
object
>(
"/Pdf/Stamper"
,
request
,
files
);
try
{
var
setting
=
getSetting
();
var
client
=
new
JsonServiceClient
(
"http://localhost"
);
var
request
=
new
StamperRequest
();
request
.
SaveFilePath
=
$"/Storages/Pdf/test_
{
setting
.
StampType
.
ToString
()}
.pdf"
;
request
.
OpenFilePath
=
"/Storages/Pdf/Test/test.pdf"
;
request
.
Settings
=
new
List
<
StampSetting
>();
request
.
Settings
.
Add
(
setting
);
//var files = new List<UploadFile>();
//files.Add(new UploadFile("a.pdf", new FileStream(tbxPdfFilePath.Text,FileMode.Open)));
setting
.
StampFilePath
=
"/Storages/pdf/Stamp_CN_JST_V1.png"
;
//if (!setting.StampFilePath.IsNullOrEmpty())
//{
// files.Add(new UploadFile(Path.GetFileName(setting.StampFilePath), new FileStream(setting.StampFilePath, FileMode.Open)));
// setting.StampFilePath = Path.GetFileName(setting.StampFilePath);
//}
//if (!setting.SignatureFilePath.IsNullOrEmpty())
//{
// files.Add(new UploadFile(Path.GetFileName(setting.SignatureFilePath), new FileStream(setting.SignatureFilePath, FileMode.Open)));
// setting.SignatureFilePath = Path.GetFileName(setting.SignatureFilePath);
//}
//var rtns = client.PostFilesWithRequest<StamperResponse>(request, files);
var
rtns
=
client
.
Post
(
request
);
}
catch
{
}
}
}
}
packages.config
View file @
8c790deb
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"Kivii.Common"
version
=
"5.5.2020.
606
0"
targetFramework
=
"net40"
/>
<
package
id
=
"Kivii.Pdf"
version
=
"5.5.2020.
626
0"
targetFramework
=
"net40"
/>
<
package
id
=
"Kivii.Common"
version
=
"5.5.2020.
700
0"
targetFramework
=
"net40"
/>
<
package
id
=
"Kivii.Pdf"
version
=
"5.5.2020.
700
0"
targetFramework
=
"net40"
/>
</
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