2

Ref: How to render PDF in Android

I have a bytestream with PDF contents and want to display the same in my android app. Is there a way I can do that without saving it as a physical file? For security reasons: I want the user to be able to just view the PDF and not store it in the phone memory or SDCard.

Does google doc viewer has the ability to take bytestream and render it? Or any other app that is installed in the android phone?

1
  • Thanks Alexanoid. From the features page, it does seem to support bytestream PDF rendering. Zero footprint - You can open PDF files directly from the byte array(memory), leaving zero footprint on the device. This means you can make your own secure document readers. Commented Nov 12, 2015 at 4:07

1 Answer 1

3

You cannot push "a bytestream" (presumably a byte[]) to another application. While there may be ways you can have another application pull the bytes to render it, any application will be able to do that, not just your PDF viewer, which will defeat your security goals.

Sign up to request clarification or add additional context in comments.

6 Comments

Is there any way to show this PDF in our application without calling another app? I need the same thing he needs. For security reasons, I can't save PDF file and I have to show it to the user in my application. I am getting it as byte stream. Is there any way to achieve this?
@GokhanArik: You are welcome to investigate the various PDF-viewing libraries for Android. You might also consider whether PDF is the best file format to be using, over HTML, which you can render locally in a WebView.
We have considered options for HTML and JPEG, but that's what client requires. I checked a couple of libraries. If you have any recommendation I would love to investigate it more.
@GokhanArik: I have not used any. Personally, I would start with Mozilla's PDF.js in a WebView. Also note that if your minSdkVersion happens to be 21, there is a PdfRenderer in Android now, though it's really geared towards print preview.
I tried PDFRenderer of Android, but still we have to have PDF file saved for that. Am I wrong?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.