[英]Display base64 string in aspx page
I am trying to display the base64 string in aspx page. 我正在尝试在aspx页面中显示base64字符串。 I am using the below code:
我正在使用以下代码:
System.Web.UI.WebControls.Image imgNew = new System.Web.UI.WebControls.Image();
imgNew.ImageUrl = string.Format("data:application/jpeg;base64,{0}", Convert.ToString(base64String));
this only works for the base64string for the jpeg formats. 这仅适用于jpeg格式的base64string 。 for the base64string of the pdf the image is not displaying properly.
对于pdf的base64string ,图像无法正确显示。 Can anyone help me?
谁能帮我? Thanks in advance.
提前致谢。
使用以下命令将byte []转换为Base64,
string base64PDF = System.Convert.ToBase64String(outputPDF, 0, outputPDF.Length);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.