how can i embed ppt in webview to run on android - android

i want to create an android application in which i have to run ppt which will be present in sdcard. So far i have got to know that the only way to run the ppt is either calling different applications which deal with this or embed that in webview.
Thanks in advance

You cannot embed ppt, doc, excel etc in a Webview in android. Those are MS Office formats. You cannot even do that on a desktop pc with firefox/chrome.
EDIT
If the ppt is online you can use google docs to convert your document to html and than display it:
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=http://myurl.com/mySlide.ppt");
If the ppt is on SD card, either:
a) Open it with default phone application. See How to use an intent to open a ppt with DataViz's Documents To Go
b) you need to convert it to html beforehand. There are many online/offline tools for that. Google "ppt to html converter"

Another possibility (depending if you no need your PPT file into the SDCard) is embed a PPT in a WebView using an iFrame like Office Web Apps or GoogleDocs.
I tested and works, but this options requires to have the PPT file into servers of Office Web Apps or GoogleDocs.

Related

Android Online PDF Load - Preview Not available error via Google Doc

The core part of my application is load PDF online and user have access to download it as per their given rights.
The problem I am facing is that I want to load pdf online. After many research I have found that,
There are likely two ways to show pdf online in android:
1) In Web view by loading simple hosted URL
2) By google doc.
But in our case, if we use way (1), the mobile web view does not redirect hosted url of PDF.
And if we use way (2), then there are certain limitations of the google docs regarding the file sizes. (Small pdf it will load like 5 to 10 with size of 1MB)
But after loading PDF with the size of 2 or 3 MB it's also giving me error as "No PREVIEW AVAILABLE" and its continuously giving me this error opening different urls.
So it seems there is still no easy solution for viewing a pdf from url (online without downloading pdf).
The other way to open pdf online is that we can open it in any other third party applications like browser, adobe pdf reader or any kind of pdf viewer application available in the device.
Cons: If we open pdf in browser then it will get downloaded automatically and if we open it in any third party application then they have options to download the pdf.
Please give me some solution to read the PDF online.
And if there are any paid pdf SDK availble which gives functionality of loading pdf online from URL, then please provide information of that too.
Please also suggest me some pdf viewer library for displaying pdf online.
I have used many of the library, but it increases my application's size to 8 to 10 MB.
Thanks in advance.
The suggested primary solution,
Download the file, store it in the app specific folder so users don't have access. For viewers who don't have access rights to download it, you will delete the file as they leave the view. For viewers who have access rights to download it, they will be given an option to copy the file to their SD card (an accessible location) and then you will delete the original file as they leave the view.
For storing in app specific directory to restrict user access,
http://www.grokkingandroid.com/how-to-correctly-store-app-specific-files-in-android/
Also use a library to view the pdf(MUCH SIMPLER), choose an appropriate one from here
https://android-arsenal.com/search?q=pdf
Alternate solution,
If security is a major concern, you can encrypt the pdf file and store it on the server. And decrypt the file when you download it to the device.
For added security, don't store the file as pdf, just store it as a file. Download it as a file. Set type as pdf when you want to access it.
Conclusion,
Data wise, Even if you load it online, the device will consume almost same data as downloading the pdf. (Infact for viewing something online, your device downloads the data and stores it in the cache and you can view it)
Security wise, only a rooted phone will be able to access the file but that too for as long as you have decided to store it.
I suggest you check out PDF.js, a Javascript library from Mozilla to render PDF's in a browser. You can adapt this into a WebView easily, and display PDF's without downloading them.
Here is an open source app which does something similar to what you're looking for

how to get a pdf document to automatically open when webpage is accessed?

I'm a bit new to this so bear with me. What I am trying to do is to get a pdf document to open automatically as soon as a webpage is launched. This webpage will be hosted locally and the pdf document(S) will be stored locally as well.
Essentially we are using an external platform that allows buttons to link to exterior webpages, but does not allow for opening documents. What we are trying to do is to bypass this limitation by having a webpage that is locally hosted that will automatically open up a pdf file which will be stored on the device.
If the webpage just contained the code <a href"link-to-pdf-doc"></a> will this suffice?
If you are wanting to embed the pdf in the web page rather than download it, a simple way is to use just a plain html object tag:
<object data="link-to-pdf-doc" type="application/pdf" width="100%" height="100%">
I am not sure how much support there is in browsers all across the board, but it will work for the majority of modern browsers.
There are also many libraries available which use browser detection to normalise the code and maybe have wider browser support:
https://github.com/mozilla/pdf.js
http://pdfobject.com

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.

Embed PPT to HTML (for a webview in Android)

Does anyone know a way to embed a PPT file (powerpoint) into a HTML?
I found solutions like embed through an iframe by Office Web App and/or Google Docs. I tried them and works fine into the HTML, but in my case I need to have the PPT file into a personal server.
Other options I found are like Embedit.in, a flash embed that shows th PPT (no convert the PPT to SWF (flash format)).
But, I still looking for a way for show a PPT file saved in a personal server into a HTML, any idea? any webservice for this problem?
Before PowePoint 2010 you could save the ppt to html using PowerPoint API.
Did you checked also for api vendors? It's a common issue probably there api to do that.
Suggestion...
Convert the ppt to pdf and use the code generator # http://pdfobject.com/generator.php .
Use standard (not java) .
There in one small mistake in the code they generate Remove the hashtag # at the end of the url.

Android Adobe Reader - Display PDF from web

I have an android application that needs to display the pdf files. For this I am using Adobe PDF reader intent and pass the file path to it.
It works fine when the pdf file is present on the sdcard but I am not able to view the pdf file when it is placed on web (i.e. http://www.myweb.com/pdfs/mypdf1.pdf).
Any idea how to do this?
Adobe Reader on Android does not seem to support this feature so far, as it is really simple.
Maybe you could try Adobe Air, but I am not sure the version on Android supports .pdf.
If not, I suggest you could pass the Intent to the browser, and the browser will download it, and then it can be displayed. Maybe there will be some browser that can open .pdf directly as those do on computer, but I am not aware any.

Categories

Resources