Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

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


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

please help me

What I have tried:

C#
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();
Posted
Updated 18-Jun-17 19:28pm
v2
Comments
Richard MacCutchan 14-Jun-17 5:01am    
Can your PDF viewer read directly from a byte array?
Member 13258586 14-Jun-17 8:36am    
i dont know how to show pdf file directly from byteArray
Richard MacCutchan 14-Jun-17 10:37am    
That is not an answer to my question. If you do not have a viewer or some other application that can render PDF from a byte stream/array then you will need to write the code yourself.
David Crow 14-Jun-17 21:55pm    
Is PdfViewer an app on your device?
Member 13258586 15-Jun-17 1:23am    
yes exactly that's what i am asking that code which will display directly

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900