HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost/");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
byte[] fileBytes = File.ReadAllBytes(@"D:\\byteCompress1.txt");
InPutData inp = new InPutData();
inp.inputarray = fileBytes;
inp.printerName = "GF Printer";
inp.docName = "test";
var response = client.PostAsJsonAsync("print/sendprint", inp).Result;
if (response.IsSuccessStatusCode)
{
///result is true
}
else
{
// result false
}
client.BaseAddress = new Uri("http://localhost/");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
byte[] fileBytes = File.ReadAllBytes(@"D:\\byteCompress1.txt");
InPutData inp = new InPutData();
inp.inputarray = fileBytes;
inp.printerName = "GF Printer";
inp.docName = "test";
var response = client.PostAsJsonAsync("print/sendprint", inp).Result;
if (response.IsSuccessStatusCode)
{
///result is true
}
else
{
// result false
}
No comments:
Post a Comment