PdfReader in Android - android

I have to develop an application which reads pdf file in pdf format and only pdf file should be read in the application.I wanted to know one more thing is it possible to use itext.jar for
the android application.

Developing an PDF reader for Android is not really simple, so I suggest you read this PDF file online by Google Docs Reader
WebView webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
String pdf = "http://www.example.com/example.pdf";//url to pdf file
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdf);
This may not be the thing you want, but still hope it helps you someday.
However some Android PDF APIs are http://code.google.com/p/android-pdf/source/browse/#svn/trunk/src/org/broncho/pdfreader and http://andpdf.svn.sourceforge.net/viewvc/andpdf/trunk/AndroidPdfViewer/src/com/sun/
You can also look at an SO discussion on the same problem Android PDF reader from scratch

You can use one of the opensource PDF readers (eg: XPDF) and compile it for Android.

Related

Viewing PDF from URL using Adobe in Android

I'm just learning Android code and I've come upon a problem which I hope you can all help.
I want to display a PDF file from a URL from my application, I've got the PDF to display using a webView method however with having Adobe Reader and Polaris Office installed on my phone I was just wondering if I can load the URL and implement the PDF to be displayed using installed software?
My webView code is as follows:
WebView web = (WebView) findViewById(R.id.webView);
web.getSettings().setJavaScriptEnabled(true);
String pdf = "http://www.example-site.co.uk/pdf";
web.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdf);
I have searched several posts on here to no avail so any help will be much appreciated.
Searching for "pdf view intent" reveals stuff like that: How to render PDF in Android
If that doesn't help, you should try to implement a IntentChooser or directly ask the devs of your two apps on which intent they are listening.

Open PDF with PhoneGap in Android

I need open an PDF file that is in an url. I need open it with an PDF Viewer...
It is possible?
Thanks for all.
Best regards.
I suggest using the ChildBrowser plugin and using Google's viewer to actualy open the PDF (since Android doesn't have a default PDF viewer).
So you can open a PDF like this:
onclick='window.plugins.childBrowser.showWebPage(encodeURI("http://docs.google.com/viewer?url=' + pdfLink + '"));
in android (i don't know phonegap) there are many pdf viewer libraries.
like Android-Pdf-Viewer-Library
or Droid Text
or MuPDF
or APV Pdf Viewer
if you develope your application commercial and don't want to pay any money
use first one.

Read pdf file from sd-card with the help of webview

Is it possible to read pdf file stored in my sd card to view in web view.
I tried using
WebView webview = new WebView(myactivity.this);
webview.getSettings().setJavaScriptEnabled(true);
File file = new File(Environment.getExternalStorageDirectory()
+ "/pdf" + "/ypc.pdf");
Uri uri = Uri.fromFile(file);
webview.loadUrl(uri.toString());
but got no results,. is any other way possible
I think PDF reader is not in-built with Android-WebView or any web-browser. it is a plugin to web-browser like Adobe PDF Reader with our PC browsers (Mozilla, Chrome, Opera, etc.)
So you must configure external PDF Reader app with Android-WebView, to read PDF files with webview.
Otherwise try Google Docs Viewer to read PDF file, but you must have internet connection and set appropriate permissions to your app.
Replace last line of your code with below line.
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + uri.toString());
I hope it may help you.

How can i view pdf in android without pdf Application in device?

i want to view pdf file from internet..can anyone tell me how can i view??
Please Use This code For view Online PDF without Using PDF of Application
mWebView.loadUrl("http://docs.google.com/gview?embedded=true&url=http://your_link/634128127095123576.pdf");
WebView webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
String pdf = "http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf";
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdf);
Please view this answer for more details: how to develop a pdf reader in android
But please be aware that webview does create some extra threads like Cookie Manager and history manager , it might just increase your memory foot print a bit. I saw this behaviour when i looked at threads created in Eclipse ADT plugin

Android - Load PDF / PDF Viewer

I want to display pdf contents on webview.
Here is my code:
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("URL/Demo_PDF.pdf");
Problem:
When i am trying to run the application, at that time I am getting blank screen.
And also, if there is any PDF viewer then also suggest me !!
FYI, I have already set internet permission.
Finally, i got a solution, actually i made a trick to load a pdf file using Google Docs inside a webview:
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=http://myurl.com/demo.pdf");
I'm sorry but WebView does not display PDF content.
What you might want is a PDF viewer that responds to the PDF MIME type.
Here are a couple of free open-source libraries you might want to check:
droidreader
apv pdf reader
You can try using mupdf (www.mupdf.com)
You can build a native code library (libmupdf.so) to be loaded onto your android project using the ndk.
This would ensure a lot faster rendering of pdf files...
check out the project at : http://mupdf.com/repos/mupdf/android/
WebView does not have a PDF plugin. You should store the PDF locally and open an intent for viewing that kind of content.

Categories

Resources