How to read, display, open pdf file in android - android

I am a beginner of android. I don't know much about working with PDF and files. Please provide me resources that can be understand easily. Is there any third party plugins should be used? I have tried searching old questions but i am unable to know where to start.

You have a very good library (AndroidPdfViewer) for API 11+ that can open, zoom and have animations.
It's simple to use just read the .readme file.
It's based on PdfiumAndroid for decoding the pdf.

You should have a url to access that document . You can use HttpURLConnection class and read subsequent bytes through it . Here is a nice example android download a file

Related

Using an online .txt file as a data source

I am building an Android app for a client and most of the data that i need is contained in an online .txt file attached to my clients website. I've never used an online .txt file as a data source before and don't really know where to begin?! Can anyone point me in the direction of a good tutorial on the subject.
Many Thanks in advance
P.S. I haven't asked whether it's possible because i have assumed it is due to the fact you can use an internal .txt file as a data source
I think the best approach is to download the file on the device and then read it like a normal file. If the file changes on a period of time, then configure the app to download and read the file and then update the local info in the app.
I don't think you can use an online txt as a DataSource, but you can implement this so you have an abstract source for your file, and then just call read on it.
Expose the txt/xml file over web,if you want to get it down to phone use URL loader and load it to the phone and operate if you want to use it online (like others may also be using it) it will be a bit complex in order to deal with data coming from more then one source but possible. clear you question a bit more.

Android: how to load pdf within app?

I have:
First goal: figure out how to load a PDF from the internet and display it whithin my app
Second (maybe more complex) goal: download a pdf and display OFFLINE within my app
I looked for some solution on stackoverflow and on the Internet but I can't figure out how to implement it
For example I found Mupdf and the source code of some PDF viewer for Android but I'm quite confused: why is so difficult to display a "simple PDF"? Is there any Java library that will do it without incorporate external source code etc.?
Any suggestion is really appreciated.
Thanks in advance!
There are some libraries and sdk.
This might help you
http://www.qoppa.com/android/pdfsdk/
http://code.google.com/p/droidreader/

Pdf in android without other applications

I want to show pdf file in android, but this must work without Internet connection and other appliacation. Can I show pdf file in webView or other view?
Yes you can show your PDF to your custom view. For, this you've to use one External Jar file for that. I've already answered like similar to your question. Just check it out.
Hope this helps you.
Using another app to display your PDFs is a really nice way to do it. Unless you have superiors forcing you to avoid other apps, I'd do it that way. There are good, free pdf viewing apps available so it won't cost your users anything.
The transition when opening a pdf in another app is pretty seamless and it's not always obvious that another app is being used.
The alternative, as SpK said, is to use a jar and write the extra pdf viewing functionality that you need. This is a much harder way to do it.

PDF reading on Android

I have to make an application that should capable of reading PDF documents on Android device. Actually I do not want my app to be dependent on other apps to read the PDF file.
I had gone through the questions that are asked here and at some other places also. They all directly or indirectly using third party app.
Is there any API or something similar is available through which I can implement reading of PDF files directly in my app? How about converting the PDF document to PNG image? But the PDF-PNG method wont let users select the texts.
Any suggestions?
Thanks
There exists an library from Adobe that you can use. Its based on the NDK and you need to do the wrapping all by yourself. Its also extremely expensive, basically nothing for a small firm/single developer but for bigger companies. Afaik the license is not only expensive but also annual based, so you need to pay for it in every year...
There are other libraries, basically open source. Some of them have good performance but a lack of functionality (most of them based on NDK, too). I found only one pure "java" library but the performance was more than worse (loading time 10sec for a page and more).
There are three possibilities you should consider:
Using an external application, so you just need to implement the library of your PDF documents
You write everything by yourself including a pdf reader part
You create a middle "tier" where you convert your PDF into PNGs or JPG (I prefer PNG for better quality). The much better performance comes with a lack of features.
I'm currently developing a complex application like mentioned in 3. but I can't go into details, sorry.
I would definitely recommend the Qoppa stuff on Android.

How do you force android to download a podcast instead of playing it?

I'm trying to find a way to bypass the selection pop-up for podcasts and just tell android to download the file.
Currently when you open a link to a podcast a little menu pops up and has two buttons. One says download, and one says listen. Instead I want "Download" or "Cancel".
I have looked into this and I found the DownloadManager class, but sadly (I think) it is only for 2.3, and the app is being developed for 2.2.
Does anyone know how android did file downloading before this? Is there a specific intent I can pass the link to?
Thanks!
Well, without code I can only guess.
It sounds as if you have a Web View or Browser that is interpreting the url being opened based on part of the url scheme. This is causing the operating system to try to resolve activities that are available for this url. You're seeing two activities (download or listen) which are supported by activities available on the phone. In this situation you will need to overload the loading of urls using this tutorial,
Of course, without some crystal ball I can't be certain of this based on what you've said. If this is the case and you want to know how to download it. You would need to build a downloader of your own, which is possible using Java Streams, Java NIO or some of the Apache HTTP Client libraries. Based on the size of your files, it may make sense to use Buffered Java Streams with the Apache Http Client objects.
You can find an example of how to do this here.

Categories

Resources