根据从HTTP响应接收到的字节流创建PDF

时间:2018-06-20 14:16:31

标签: android

我有一个由字节流组成的json。将其转换为pdf并将其保存在设备中,还创建URI并将其加载到webview中。我可以创建文件。但是当我打开它时,所有的空白页都在那里。请检查代码。谢谢您提前提供的所有帮助。

             ParseStatementReport report = (ParseStatementReport) JacksonUtils.fromJsonToJava(
                                jsonResponse, ParseStatementReport.class);

                                String reportString = report.getReportString();// getting the byte stream from json 


                                  byte[] bytes;
                        bytes=reportString.toString().getBytes(Charset.forName("UTF-8"));

                          Utils.writeToFile(this.mReportsDirPath, this.mReportFile, bytes.toString()); //create file.
                            OutputStream pdffos = new FileOutputStream( this.mFileToPrint);
                            pdffos.write(bytes);
                            pdffos.flush();
                            pdffos.close();

0 个答案:

没有答案
相关问题