我想直接从byte []显示pdf文件而不下载 [英] I want to show pdf file from byte[] directly without downloading

查看:62
本文介绍了我想直接从byte []显示pdf文件而不下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在PdfViewer中显示我的解码pdf ByteArray来自JSON数据



你可以帮助我这个我想要显示我的pdf文档来自web服务JSON数据我完成了像这样解析这个文件



i want to display my decoded pdf ByteArray from JSON Data in PdfViewer

can u help me about this i want to show my pdf docs which is comming from web service JSON data i done parsing this file like this

Object encodedData = jsonObject.get("file_data");
      byte[] decoded = Base64.decode(encodedData.toString(), Base64.NO_WRAP);





i不想下载并保存到我的记忆中

i需要在线显示。



请帮帮我



我的尝试:





i dont want to download and save it to my memory
i need to show online .

please help me

What I have tried:

Object fileName = jsonObject.get("file_name");
              Object encodedData = jsonObject.get("file_data");
              byte[] decoded = Base64.decode(encodedData.toString(), Base64.NO_WRAP);
              file = new File(destFolder, fileName.toString());
             if (file.exists())
                        file.delete();

                    output = new FileOutputStream(file);
                    output.write(decoded);
                    output.flush();
                    output.close();

推荐答案

根据 this [ ^ ]如果你第一次保存,你可以使用Adobe PDF阅读器显示字节数组中的PDF它是一个本地文件。



/ ravi
According to this[^] SO post, you can use the Adobe PDF reader to display the PDF you have in your byte array if you first save it to a local file.

/ravi


这篇关于我想直接从byte []显示pdf文件而不下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆