string pdf_file_path = "";
string pdf_file_name = "";
string labelUrl = "";
string strLabelSavePath = "";
string strFileName = "PRINT_" + DateTime.Now.ToString("yyyyMMddHHmmss");
if (resultroot.WayBillUniteResponseData.LogisticalNumFile != null)
{
pdf_file_path = string.Format("/api-lable/pdf/{0}/", DateTime.Now.ToString("yyyyMMdd"));
pdf_file_name = string.Format("{0}.pdf", System.Guid.NewGuid().ToString());
string pdf_output_filepath = System.Web.HttpContext.Current.Server.MapPath("~" + pdf_file_path);
byte[] imagebyte = Convert.FromBase64String(resultroot.WayBillUniteResponseData.LogisticalNumFile);
strLabelSavePath = pdf_output_filepath + pdf_file_name;
string strDirectory = System.IO.Path.GetDirectoryName(strLabelSavePath);
if (!Directory.Exists(strDirectory))
{
Directory.CreateDirectory(strDirectory);
}
using (var mem = new MemoryStream(imagebyte))
{
using (var file = new FileStream(strLabelSavePath, FileMode.Create, FileAccess.Write))
{
mem.WriteTo(file);
}
}
labelUrl = "http://" + DTRequest.GetCurrentFullHost() + pdf_file_path + pdf_file_name;
}
base64转图片转pdf.txt C#
最新推荐文章于 2024-07-10 13:30:42 发布