General Word Processor png previewing and indexing code.

HI folks,
         I just made the following commits to AbiWord CVS.
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS: Committing in .
CVS: Modified Files:
CVS:    ConvertToText.c ConvertToText.h xp/AbiCommand.cpp
AbiCommand New feature previewpng, ConvertToPNG server implementation.

CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS: Committing in .
CVS: Modified Files:
CVS:    src/af/gr/unix/gr_UnixGraphics.cpp
CVS:    src/af/gr/unix/gr_UnixGraphics.h
CVS:    src/af/gr/unix/gr_UnixImage.cpp src/af/gr/unix/gr_UnixImage.h CVS:
   src/wp/ap/unix/ap_UnixApp.cpp src/wp/ap/unix/ap_UnixApp.h
CVS:    src/wp/ap/xp/ap_Preview_Abi.cpp
AbiWord side of previewpng. Particularly note new ap_UnixApp method,
makePngPreview(const char * pszInFile, const char * pszPNGFile, UT_sint32
iWid\th, UT_sint32 iHeight


This implements a feature, "previewpng" in AbiCommand plus a
C-interface to an externally running AbiWord processes in
ConvertToText.(h,c). The
C interface is really simple:

 * The function is fault tolerant and will report if a requested
 * file is not capable of being coverted.
 * It will also restart AbiWord if it does crash on the next invocation
 * of convertFileToPNG.
 * Inputs: inFile - The path to the word processor file to be converted.
 *         outFile - The path to the PNG image of the first page of the doc
 *         iWidth - width in pixels of the document.
 *         iHeight - height in pixels of the document.
 * The function blocks until the conversion is complete or until
 * the conversion fails.
 * It returns 0 upon a successful conversion
 *    and -1 if the conversion fails.
int convertFileToPNG(const char * inFile, const char * outFile, int
iWidth, int iHeight)

This is useful for showing a preview of the document that you've found and
indexed in dashbaord via ConvertToText :-)

To build this you need CVS AbiWord and CVS abiword-plugins

ConvertToText.(h,c) is located in the abiword-plugins/tools/abicommand
directory. It's LGPL'd licensed but feel free to port to C# if you prefer.
The code pretty straight forward.

Right now an entrie document is loaded and all the views are filled in
order to just get a preview of the first page. I'm pretty sure we don't to
do this. If I can work out a way to load just the first bit a document,
previews of huge documents should be the same speed as small documents.

I'll experiment with algorithims to do this but right now things work and
you can use this code to throw up a preview of selected Word Processor

(My visions is for a preview of a document to be displayed next to a
selected document. This should give a powerful visual clue as to whether
document you've found is the one you want.)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]