8

What libraries are there that can be included in a commercial Android client application for simple viewing (editing not required) of doc, docx, xls, xlsx, ppt, pptx, odt, pdf, rtf?

Preferably free or inexpensive. Must be well maintained and without critical bugs.

I've researched quite a few libs (docx4j, aspose.com), and solutions such as the Google doc viewer API, but I have no definite answer yet and I may have missed something.

I can't use simple VIEW intents because I want to be able to show my app's branding on top of it and prevent the viewer from editing that file. Even some converter that reliably converts these file to HTML so I can show the file via webview would be fine.

Thanks!

  • Does it need to work offline? Or is it OK to query a server each time you want to display a new document? – Nicolas Raoul Apr 2 '15 at 4:52
  • It would be preferable to be available client side with local documents, but online solution is ok too. – TudorT Apr 7 '15 at 19:58
  • @TudorT Hi, any luck? – Hank Moody Oct 18 '17 at 8:27
  • @HankMoody We ended up using Google Sheets/etc for most of the doc types and custom editors for other formats. There may be other solutions now though, this was a quite a while ago. – TudorT Nov 4 '17 at 11:49
4

Alfresco is open source and can create previews for a lot of different file formats, including doc, docx, xls, xlsx, ppt, pptx, odt, pdf, rtf, txt and more.

Alfresco preview

So you could install Alfresco on a server and query it using an Alfresco WebScript. Alfresco previews are actually PDFs transformed to SWF, and SWF is not good for Android, so you need to catch the file at the PDF stage, it might require to create a new Alfresco WebScript (which is relatively easy).

While Alfresco is mainly written in Java (and thus portable to Android), I believe that the transformation part of Alfresco is not written in Java.


Headless LibreOffice for Android would allow for offline DOC→HTML-type operations. LibreOffice is getting ported to Android, but it is not ready yet and it will probably take a while before it is available headless.

2

Depending on whether you can work online or not might certainly narrow some of your options.
As Nicolas suggested, something based on OpenOffice/LibreOffice is a good starting point - that would let you get the various document formats rendered well into PDF for view-only ability. You could use JODConverter (opensource) or Docmosis (commercial) to do this. If you wanted to go to HTML5 display instead, IDRSolutions jpdf2html5 (commercial) converter is good.

If you have time, you could roll your own REST API over a converter service and host it yourself based on the same technologies.

Please note I work for the company that created Docmosis.

I hope that is useful.

  • +1 Interesting! Can Docmosis-Java run offline on Android? – Nicolas Raoul Apr 7 '15 at 5:43
  • Not currently. On mobile devices you're currently limited to the SAAS solution or calling back to a middle tier of your own that uses Docmosis. – Paul Jowett Apr 23 '15 at 0:38
0

The LEADTOOLS Android SDK contains Android native libraries which you can use to render your document formats in a viewer on the device itself so that you don't have to worry about a web service performing the conversion for you. The LEADTOOLS Android SDK also contains viewer controls for loading your documents along with allowing you to pan/zoom/scroll/etc on the loaded documents as well to give a better viewing experience. We have some Android demos on the Google Play Store which show the viewer functionality.

If you are leaning more towards the web hosting and just having a webview, the LEADTOOLS Document Viewer SDK is a great document viewer solution that contains back end services for performing the conversion from your document file formats to a browser supported MIME type for viewing in the browser. We have an online demo of the LEADTOOLS HTML5 Document Viewer as well.

enter image description here

Just as a disclaimer. I work for the company that wrote this library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.