0

I would like knowing if it's possible to obtain the preview image (thumbnail) of any text file in Android, like PDF, DOC, TXT, PPT, PPTX, RSS or HTML. If the response is positive, how do I can make it?

I have the preview images of video and image files, and I want to obtain the same result for text files.

Thanks for your attention, greetings.

KryNaC
  • 379
  • 4
  • 21
  • How would a preview image of a 100KB .txt file look like? How would the preview image of a 100 slide .ppt file look like? – greenapps Oct 22 '14 at 13:19
  • The first page or slide ... as some messaging programs such as GMAIL or HOTMAIL, for example. – KryNaC Oct 22 '14 at 13:25

1 Answers1

0

This can be quite a problem since you need to handle every file type individually.

TXT, RSS and HTML are simple enough, you can just read them all like a text file and display the text on the screen (first X characters, for instance, either with a TextView or by manually drawing it in the onDraw method. However, if you want to render the HTML, look at this question.

PDF is another story, you need some sort of rendering endine for that, you might want to look at MuPDF.

RSS and HTML Can work the same way as a normal TXT file.

PPT, PPTX and DOC will also need a custom renderer, you might want to look at this question.

Community
  • 1
  • 1
Squeazer
  • 1,234
  • 1
  • 14
  • 33
  • All this is quite complex to manage, is there a simpler way to get the thumbnails? as in the case of images (ThumbnailUtils.extractThumbnail) or videos (ThumbnailUtils.createVideoThumbnail) – KryNaC Oct 22 '14 at 14:06
  • I'm afraid not. Maybe if there exists a library that puts all of this together, but I couldn't find anything. – Squeazer Oct 22 '14 at 14:10