-2

Hi StackOverFlow Community, I am trying to create an android app in which i had to show the Syllabus of our college comprising of various branches,for which i had the data in PDF format of 100's of pages.Now what is the best way to display all the text for my users.I myself got some ideas but don't know how to implement them they are

  • Opeaning the PDF's directly in my app(Coudn't understand how to do this any tutorials are welcomed.)
  • Storing the text in a offline like a HTML format and opening them in webview(Don't know whether it's possible but heard we can do this.)
  • Screen shots of each page and opeaning in an image viewer(Very hard task given that there are 100's of pages for a single branch and not so user friendly.)

Any other effective methods are welcomed along with tutorials as i am new here and any idea of implementing the first or second method also please.Sorry if i had said any thong wrong, Thank you.

Prudhvi Reddy
  • 117
  • 2
  • 17
  • Just send the PDF file to a default android PDF viewer and save yourself time – Yury Fedorov Jun 30 '16 at 10:41
  • @Orlangure thanks for your suggestion but I am doing this project as a part to earn some pocket money for my self.In my whole app this is the only space the user could spend some time reading some text and increase the user impressions on the ads,so it is not possible for me to send it to default PDF viewer. – Prudhvi Reddy Jun 30 '16 at 10:57

2 Answers2

1

Try this code for opening the pdf file.

public class MyPdfViewActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WebView mWebView=new WebView(MyPdfViewActivity.this);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setPluginsEnabled(true);
    mWebView.loadUrl("https://docs.google.com/gview?      embedded=true&url="+LinkTo);
    setContentView(mWebView);
}
}
Ram Koti
  • 2,203
  • 7
  • 26
  • 36
  • thank you @Ram i know this way to use webview to display pdf's but this is not an effective way and also i want the app to be offline. – Prudhvi Reddy Jun 30 '16 at 11:20
0

Use this Android-Pdf-Viewer-Library to open pdf in your android application and its also save your lots of time.