You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Espen Ø. Pedersen" <ep...@corena.no> on 2004/10/19 10:47:27 UTC

Thumbnail issue

Hi there!

I'm trying to extract thumbnails from MS office documents and then
convert them to jpeg or gif. So far I've managed to extract an byte[]
array from a file, with the following lines:

try {
   SummaryInformation summaryInfo = new SummaryInformation(ps);
   Thumbnail thumbnail = new Thumbnail(summaryInfo.getThumbnail());
   byte [] thumbBytes = thumbnail.getThumbnail();
}
catch (UnexpectedPropertySetTypeException e)
{
   e.printStackTrace();
}
catch (HPSFException e)
{
   e.printStackTrace();
}

I've then tried writing the byte array to an FileOutPutStream and here I
am with a 21 KB file, that I'm not really sure what is and how to
display/read?

I've tried thumbnail.getThumbnailAsWMF but it's gives an exception
telling me that the format is not CFTAG_WINDOWS, wich probably is true ;-)

-- 
Espen Ø. Pedersen

Company: CORENA Norge AS
Address: Industritunet, Dyrmyrgt. 35, N-3611 Kongsberg
Phone:   +47 32 71 72 29
Skype:
E-mail:  epe@corena.no

http://www.corena.com




---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Re: Thumbnail issue

Posted by Rainer Klute <kl...@rainer-klute.de>.
Am Di, 2004-10-19 um 10.47 schrieb "Espen Ø. Pedersen":
> I'm trying to extract thumbnails from MS office documents and then
> convert them to jpeg or gif. So far I've managed to extract an byte[]
> array from a file...

> I've then tried writing the byte array to an FileOutPutStream and here I
> am with a 21 KB file, that I'm not really sure what is and how to
> display/read?
> 
> I've tried thumbnail.getThumbnailAsWMF but it's gives an exception
> telling me that the format is not CFTAG_WINDOWS, wich probably is true ;-)

HPSF has no knowledge about the thumbnail formats. In the source code
resp. in the javadoc there are some links to Microsoft documentation
that might be helpful for you. But the bottom line is that you have to
find out yourself how to proceed. If you can create a general solution
I'd be interested to integrate it into HPSF.

Best regards
Rainer Klute

                           Rainer Klute IT-Consulting GmbH
  Dipl.-Inform.
  Rainer Klute             E-Mail:  klute@rainer-klute.de
  Körner Grund 24          Telefon: +49 172 2324824
D-44143 Dortmund           Telefax: +49 231 5349423


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org