Friday 15 March 2013

android - Can't open PDF file after decoding String -


I need help for this problem, I am getting base 64 string for PDF file from web service and I'm using it in the Android application to convert it to PDF file again in the code

  string PDF = "Javierberry 0XLGINGLGJ 9MNCCCMMbBYMNPDWT TG ..."; Byte [] pdfAsBytes = Base64.decode (pdf.getBytes (), 0); Try {File file = path = new file (Environment.getExternalStorage directory (+ + "/ filename.pdf"); FileOutputStream OS = New FileOutputStream (file path, true); Os.write (pdfAsBytes); Os.flush (); Os.close (); } Hold (exception e) {e.printStackTrace (); }  

Now I am using an Adobe Reader to open this file for Android, but I am getting this error: Document Cendatting is being opened because it is a vaild PDF Document is not there.

Am I doing anything wrong?


No comments:

Post a Comment