List of usage examples for org.apache.poi.hpsf SummaryInformation getThumbnail
public byte[] getThumbnail()
From source file:com.oneis.graphics.ThumbnailFinder.java
License:Mozilla Public License
/** * Try and get a thumbnail from an old Microsoft Office document *//*from ww w. j a v a 2 s.c o m*/ private void findFromOldMSOffice() { try { File poiFilesystem = new File(inFilename); // Open the POI filesystem. InputStream is = new FileInputStream(poiFilesystem); POIFSFileSystem poifs = new POIFSFileSystem(is); is.close(); // Read the summary information. DirectoryEntry dir = poifs.getRoot(); DocumentEntry siEntry = (DocumentEntry) dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME); DocumentInputStream dis = new DocumentInputStream(siEntry); PropertySet ps = new PropertySet(dis); dis.close(); SummaryInformation si = new SummaryInformation(ps); if (si != null) { byte[] thumbnailData = si.getThumbnail(); if (thumbnailData != null) { Thumbnail thumbnail = new Thumbnail(thumbnailData); byte[] wmf = thumbnail.getThumbnailAsWMF(); // Got something! thumbnailDimensions = tryWMFFormat(new ByteArrayInputStream(wmf), outFilename, outFormat, maxDimension); } } } catch (Exception e) { logIgnoredException("ThumbnailFinder Apache POI file reading failed", e); } }
From source file:org.modeshape.sequencer.msoffice.MSOfficeMetadata.java
License:Apache License
public void setSummaryInformation(SummaryInformation si) { title = si.getTitle();/*from w w w . j ava 2 s.c om*/ subject = si.getSubject(); author = si.getAuthor(); keywords = si.getKeywords(); comment = si.getComments(); template = si.getTemplate(); lastSaved = si.getLastSaveDateTime(); revision = si.getRevNumber(); totalEditingTime = si.getEditTime(); lastPrinted = si.getLastPrinted(); created = si.getCreateDateTime(); pages = si.getPageCount(); words = si.getWordCount(); characters = si.getCharCount(); creatingApplication = si.getApplicationName(); thumbnail = si.getThumbnail(); }