No such conversion tool exists (at least not standard), but you might find some good preview generators or tools that tie existing ones together (see below). There are many, many document formats, and all of these formats are defined by the applications that work with them (random examples: PDFs, Word Documents, ODS spreadsheets, PowerPoint presentations, HTML documents [where some strings aren't part of content], JPG images of text, compiled programs, database files, zipped files, gzipped files, bzipped files, the list goes on and on). It would be virtually impossible to create a program that could read every document data format in existence, decode the data and pull out the actual content.
The typical strategy a search indexer / preview generator takes is to make a guess at the file type, invoke some filter than can grab relevant text, and process / preview that. Usually, this is accomplished by the author either writing a small set of filters for common types on his own (doing the research to learn about the format specifications), or by the application providing some type of extensible plugin-style framework and leaving it up to third-parties to write the filters. Many times it is a combination of both.
Nautilus takes a combination of these approaches, for example. For some formats, like common image formats, it can generate previews on its own. For other formats, it relies on third-party scripts, created by the authors of the applications and specified to Nautilus in gconf, that define various document formats, to parse documents and generate thumbnail images. It simply delegates the task of generating previews to these scripts, which are then stored as image files and displayed by Nautilus.
Any search indexer you find will operate on a similar principle.
You may want to research a few other options, including but certainly not limited to:
- Use of existing search software. Here is a good list and review of options available for Linux: http://www.tuxradar.com/content/best-linux-desktop-search-tools (if you have ADD: their top 3 in order are Recoll, Beagle, Google Desktop).
- If you are writing your own, consider writing one that can use already-written filters.
- Think of the document types you really want to support and write a script that uses a combination of
file and whatever filter tools (e.g.
- Settle for limited uncompressed raw text and use