Encoded .docx to Base64String then Decode to .pdf got error

  • Thread starter Thread starter danyeungw
  • Start date Start date
D

danyeungw

Guest
The base64 string was encoded from a .docs file. When I decoded the base64 string to .pdf, I got this error: "Adobe Acrobat Reader could not open '' because it is either not a supported file type of because the file has been damaged (for example, it was sent as email attachment and wasn't correctly decoded).

string base64EncodedData = System.IO.File.ReadAllText(@"C:\Temp\Base64String.txt");
var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
File.WriteAllBytes(@"C: \Temp\Base64StringOut.docx", base64EncodedBytes);


The Base64String.txt contains the string that was encoded from a .docx file.

Please help. Thanks.

Continue reading...
 
Back
Top