Commit 8c790deb by 施晓雨

1

parent add1d346
......@@ -32,12 +32,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.0, Version=5.5.2020.6060, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Kivii.Common.5.5.2020.6060\lib\net40\Kivii.Common.V4.0.dll</HintPath>
<Reference Include="Kivii.Common.V4.0, Version=5.5.2020.7000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Kivii.Common.5.5.2020.7000\lib\net40\Kivii.Common.V4.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Kivii.Pdf.V4.0, Version=5.5.2020.6260, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Kivii.Pdf.5.5.2020.6260\lib\net40\Kivii.Pdf.V4.0.dll</HintPath>
<Reference Include="Kivii.Pdf.V4.0, Version=5.5.2020.7000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Kivii.Pdf.5.5.2020.7000\lib\net40\Kivii.Pdf.V4.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
......
......@@ -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; }
}
}
......@@ -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 { }
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.5.2020.6060" targetFramework="net40" />
<package id="Kivii.Pdf" version="5.5.2020.6260" targetFramework="net40" />
<package id="Kivii.Common" version="5.5.2020.7000" targetFramework="net40" />
<package id="Kivii.Pdf" version="5.5.2020.7000" 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