3

I want to be able to open a pdf file from my application without any other application like pdf viewer. I don't want to make the user install an other appliation to open pdf files. Is there any open source library that I can use in my project?

Yury
  • 20,618
  • 7
  • 58
  • 86
haythem souissi
  • 3,263
  • 7
  • 50
  • 77
  • possible duplicate of [Custom pdf viewer in android](http://stackoverflow.com/questions/4592384/custom-pdf-viewer-in-android) – mah Feb 27 '12 at 16:10
  • i don't want to copi classes, i asqued if there is a library that i can integrate in my project, than directly call the library functions – haythem souissi Feb 27 '12 at 16:57

3 Answers3

3

You can open a PDF in a webview using google docs. The URL format is

https://docs.google.com/gview?embedded=true&url=http://link.to.your/pdf_file.pdf

triad
  • 20,407
  • 13
  • 45
  • 50
  • i get this answer: Sorry we are enable to find the document et the original source. Verifie tha the documetn still exist. please i can not see the doc, so if you are seeing it send it please at: haythemmm@gmail.com – haythem souissi Feb 27 '12 at 20:24
2

You can use, for instance, MuPdf Reader. I described how to build it here.

Community
  • 1
  • 1
Yury
  • 20,618
  • 7
  • 58
  • 86
  • finally i found the solution we have to install ndk-android and cygwin. then we are able to build .so from .c file. For more explanation you can see this, it helped me very much: http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/ – haythem souissi Feb 29 '12 at 14:45
  • But you do not ask about this ) – Yury Feb 29 '12 at 14:53
0

You can open a PDF in a webview using google docs. The URL format is

https://docs.google.com/gview?embedded=true&url=http://link.to.your/yourfile.pdf

or you can open pdf using pdf viewer Follow this code

            FileFinalpath = SdCardpath + "/" + Filepath + Filename;
            File file = new File(FileFinalpath);
            if (file.exists()) {
                Uri filepath = Uri.fromFile(file);
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(filepath, "application/pdf");
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                try {
                    startActivity(intent);
                } catch (Exception e) {
                    alert.showAlertDialog(PDF_Activity.this, "File Not Started...","File Not Started From SdCard ", false);             
                    Log.e("error", "" + e);
                }

            } else {
                alert.showAlertDialog(PDF_Activity.this, "File Not Found...","File Not Found From SdCard ", false);             

            }