Read the contents of the PDF file onto a webView - android

In my project I have to load the contents of a PDF located in the assets folder onto a WebView.Can It be achieved directly just by reading the contents onto a WebView.. I googled a lot and I found that i need to use third party PDF readers to achieve the same?
If so, Plz give me the links of the source of the PDF reader of GITHUB. Am not able to find it..

If you load pdf inside the webview, unicode text type or images wont be visible. So you want
to go for OCR tool.
Use set of libraries and sdk
This might help you
http://www.qoppa.com/android/pdfsdk/
http://code.google.com/p/droidreader/

mupdf is the best library in terms of performance and all i have found till now, you can also use it in your application.
But it needs knowledge of ndk.
Click here for more description

Related

How to open documents located in Local Storage in android using WebView?

I have a doc/ppt/xls file located in my sd card. I want to open it without any third party app (i.e within my app itself) using webview. Though I am able to open documents by embedding it in google docs url like -
http://docs.google.com/gview?embedded=true&url=[filelinkHere]
But how to open a file located in internal or external storage in webview ?
Also, Suggest me any third party ALL-IN-ONE library for android to view all types of documents. I have tried ASPOS but it has few unresolved bugs and APACHE-POI is difficult to use.
I had the same issue few days ago .
i found Android PdfViewer best to view PDF files and Android PdfMyXml best to create pdf files in android.
For working with Word and Excel as a most reliable answer I suggest you to take a look at OliveDocLibrary .
If your documents are in cloud so there is an alternative way to display docx,pptx,pdf and such formats with a combination of Webview and googleDoc.
You might find other possible solutions in server-side machines or maybe a creative way!
Hope it help
You can integrate some library project to your project with which you can open the pdf file inside your app.
Reference :
https://github.com/tekinarslan/AndroidPdfViewer
https://github.com/JoanZapata/android-pdfview

How to load a .pdf or a .doc file in android

I want to show a pdf (preferably) or a word document in my app; like a privacy notice screen. Many applications have it, so it should be possible. i tried loading a simple text file as a start but doesn't provide formatting, fonts or trade mark symbols. I've gone through a few posts but I couldn't apply it to my app. Could anyone tell me how is it done? Could I store the file somewhere in res folder and provide a path to open it through my code? I looked into the following link but I'm not sure if that's the right approach in my case android: open a pdf from my app using the built in pdf viewer.
Android does not support opening PDF and DOC files natively. You'd have to make your own implementation.
Like t0mm13b said, you should consider using HTML (+ CSS) instead and use a WebView.

android- Converting pdf into images

I'm developing an Android application which involves reading pdf files.
Initially on syncing with the server a set of pdf files will be saved into the device's SD card.
Now, I have a requirement to convert this pdf file into images. Because on doing that the speed of loading the pages are faster..
can anyone help me with this and if possible give me links to some sample code..
I got this idea from here https://stackoverflow.com/a/4779852/1105585 ....
but i don't know how this works... help plz..
I'm currently working on an app that loads files and adds effects to the images. One of the formats suppose to support is PDF. I used leadtools libs for the rasterrizing pdfs (converting pdf into raster images) and some image effects.
Hope this helps.
PDF isn't made up of images, they're vectors,.
couple open-source java PDF to Image converters
http://www.jpedal.org/
http://code.google.com/p/pdfonejava/
On desktop I've used iText java library for that kind of task. Not sure if its Android compatible but worth of giving a shot as its easy to implement.

PDF Viewer Widget in Android

I have to provide the functionality of showing PDF docs in my app without using any external PDF viewer. I know Android doesn't have such kind of widget and WebView can't load a PDF doc.
So I want to know, is there any widget available which can be used to show the PDF docs in Activity (like WebView is used to show web pages)?
As I know, there is no such 'off-the-shelf' solution available for Android yet. You can of course download any third party PDF viewer's code and modify it as per your needs.
Some of the Open source PDF viewers:
IcePDF
DroidReader
This has already been covered at https://stackoverflow.com/questions/4665957/pdf-parsing-library-for-android
Another solution would be to use a WebView, but then use the pdf.js library to display a given pdf file. I doubt this would look very nice on a small mobile device since it's designed for desktop browsers, but its worth a try.
pdf.js website and demo

Open a pdf file inside a webview.

I have an app where I've button on a webpage that is rendered inside a webview.
Now on click of button , a pdf file gets downloaded , and the same would then need to be opened inside the same webview.
attach a download listener to the web view and change the url as follows..
"https://docs.google.com/gview?embedded=true&url=https://www.example.com/xxxxxyyyyyxz.pdf"
example
https://docs.google.com/gview?embedded=true&url=https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf
it's a link used to open pdf without downloading it...
I hope it solves your problem..
I've found that the google viewer seems to work within the android browser for viewing online PDF files. You could build a link to your pdf so that it is displayed in the viewer. I've not tried doing that within a WebView though.
UPDATE
The link is dead, there is an explanation of how to get the functionality to still work at this link.
In case this link also dies, here is the relevant section:
While the page is no longer available as it redirects to Google Docs/Drive, you can still use the Google Docs Viewer. Paste this URL in a new tab:
https://docs.google.com/viewer?url=
and then paste the address of the document you want to view online. Here's an example:
https://docs.google.com/viewer?url=http://research.google.com/archive/bigtable-osdi06.pdf
I do not think that the present android chrome based browser can support pdf. There are discussion about the same in android forums ( ex: link1 link2)
Your best bet to show pdf is to have adobe pdf reader for android installed.(or concisely put, not possible in web view)
I don't think any browser other than Chrome supports rendering PDFs without a plugin or third party tool. It's probably easier to let the user use his own app to open PDFs.
I used the IText PDF library mentioned in this thread
Android : Is there any free PDF library for Android for a sample project. You could try getting using this API to get the PDF page as an image. I am not familiar with every aspect of Itext so it might have better way to do this.

Categories

Resources