具有二进制数据,需要将其转换为PDF

具有二进制数据,需要将其转换为PDF,pdf,binary,creation,Pdf,Binary,Creation,pdf正在本地生成,但已损坏。消息为“adobe reader无法打开,因为它不受支持或已损坏”。下面是我正在使用的代码。二进制内容肯定是pdf内容。请帮助 string path= "E:/J/test1.pdf"; byte[] binrydata = System.Convert.FromBase64String(content); binrydata = Encoding.ASCII.GetBytes(content) System.IO.FileStream stream = ne

pdf正在本地生成,但已损坏。消息为“adobe reader无法打开,因为它不受支持或已损坏”。下面是我正在使用的代码。二进制内容肯定是pdf内容。请帮助

string path= "E:/J/test1.pdf";

byte[] binrydata = System.Convert.FromBase64String(content);
binrydata = Encoding.ASCII.GetBytes(content)

System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.Create);
stream.Write(binrydata, 0, binrydata.Length);
stream.Close();

假设内容真的是base64编码的PDF

string path= "E:/J/test1.pdf";

byte[] binrydata = System.Convert.FromBase64String(content);
//Don't do this. Oops.
//binrydata = Encoding.ASCII.GetBytes(content)

System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.Create);
stream.Write(binrydata, 0, binrydata.Length);
stream.Close();
可能重复的