我得到了来自web服务的响应字节如何将其显示为pdf

时间:2018-02-18 08:03:29

标签: android

“%PDF-1.4                                                                                      %¢£                                                                                      3 0 obj                                                                                      <>                                                                                      流                                                                                      ÿØÿàJFIF��ÿá|ExifMM* GT; V·FQ !问:问:Z ^&安培; úèU0ê`:p ±ÿÛ C $“& 0P40,,0bFJ:Ptfzxrfpn¸®npÚ¢¢¢ÎÎÎ|ÎòàÈð¸ÊÎÆC”$$ 0 * 0 ^ 44 ^ÆpÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÿÿ k“ ÿÄ

1 个答案:

答案 0 :(得分:0)

这是解决方案.. 谢谢你的回复

           try{
                long lenghtOfFile = response.length;

                //covert reponse to input stream
                InputStream input = new ByteArrayInputStream(response);
                File path = Environment.getExternalStorageDirectory();
                File file = new File(path, filename);
                map.put("resume_path", file.toString());
                BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(file));
                byte data[] = new byte[1024];

                long total = 0;

                while ((count = input.read(data)) != -1) {
                    total += count;
                    output.write(data, 0, count);
                }

                output.flush();

                output.close();
                input.close();
            }catch(IOException e){
                e.printStackTrace();

            }