1

In my application I want display contents of .PDF or .DOCX (containg text and images ) so that it looks like an viewing android application instead viewing it pdf or docx Reader ?

2 Answers2

1

to display a PDF, you could use Google Drive document viewer inside a webview to do so.

String pdf = "mypdfFile.pdf";
webview.loadUrl("drive.google.com/viewerng/viewer?embedded=true&url=" + pdf);

works with .docx too, atleast on a native chrome browser, you should modify the webview to display it.

CptEric
  • 897
  • 9
  • 23
  • I am making an offline android application and problem is that there are a lot of images and text in my document and i want to display the same in my app so came up with an idea to display an document instead of creating individual layouts because they are making apk size heavier – user2239842 Aug 10 '15 at 07:21
  • it will be far more heavy if you load big documents than if you use XML and java classes, as far as i know. being offline, i cannot think of any way of displaying embedded documents as if they were part of the application. – CptEric Aug 10 '15 at 07:26
  • But if i am using images than APK size is growing more than using PDF. Please help me.. – user2239842 Aug 10 '15 at 08:34
0

Your question has ever been asked on a lot of other posts, you can find some hints here for .PDF :

PDF Library to rendering the PDF files in Android

And for .DOCX :

How to open MS Office files in Android

Community
  • 1
  • 1
RBische
  • 116
  • 3
  • 9
  • I integrated but the images were blurred I was unable to make it full screen. more issues and it feels like reading a document. – user2239842 Aug 10 '15 at 06:57