[android-developers] Re: Convert from Byte array to Pdf format
You better use this : File dir = Environment.getExternalStorageDirectory(); String filename = test.pdf; File f = new File(dir, filename); f.createNewFile(); OutputStream outStream = new FileOutputStream(f); ... outStream.close(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Convert from Byte array to Pdf format
Yes, Thank you JP... I got the solution... //Creating new File in sdcard byte[] bytes; File createfile = new File(/sdcard/Androidrox/); createfile.mkdirs(); File outputFile = new File(createfile, Sample.pdf); FileOutputStream fos = new FileOutputStream(outputFile); //Writing into the PDF File strByte = (xpp.getText().toString()); bytes = Base64.decode(strByte.toString(),Base64.DEFAULT);//Converting Base64 to byte String filepath = /sdcard/Androidrox/Sample.pdf; OutputStream pdffos = new FileOutputStream(filepath); pdffos.write(bytes); pdffos.flush(); pdffos.close(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Convert from Byte array to Pdf format
Michael points in the right direction. You need write permission to / sdcard, which is known as external storage. Here's the documentation: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal You also need to add the WRITE_EXTERNAL_STORAGE permission to the app manifest. On Jun 6, 3:35 am, RAJESH RAJARAM rajeshrajar...@gmail.com wrote: Convert the byte array data to the PDF Format. I'm getting the error in the line of FileOutputStream pdffos = new FileOutputStream(filepath); My code is like this bytes = Base64.decode(temp.toString(),Base64.DEFAULT); String filepath = /sdcard/test.pdf; FileOutputStream pdffos = new FileOutputStream(filepath); pdffos.write(bytes); Give me some Idea to get the PDF File formate from the byte array. Note: I got the byte array from binary format. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en