我需要帮助解决这个问题,我从网络服务中获取PDF文件的base64字符串,并且我使用此代码将其再次转换为Android应用程序中的PDF文件
String pdf = "JVBERi0xLjYNJeLjz9MNCjcgMCBvYmoNPDwvTG ... ";
byte[] pdfAsBytes = Base64.decode(pdf.getBytes(), 0);
try{
File filePath = new File(Environment.getExternalStorageDirectory()+"/filename.pdf");
FileOutputStream os = new FileOutputStream(filePath, true);
os.write(pdfAsBytes);
os.flush();
os.close();
}
catch (Exception e)
{
e.printStackTrace();
}
现在我使用Adobe Reader for android打开此文件,但我收到此错误:文档无法打开,因为它不是虚拟PDF文档。
我做错了什么?