if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); if (!(getClipboardFormat() == CF_METAFILEPICT)) { throw new HPSFException("Clipboard Format of Thumbnail must " + "be CF_METAFILEPICT."); byte[] thumbnail = getThumbnail(); int wmfImageLength = thumbnail.length - OFFSET_WMFDATA; byte[] wmfImage = new byte[wmfImageLength];
/** * Returns the thumbnail (or {@code null}), processed * as an object which is (largely) able to unpack the thumbnail * image data. * * @return The thumbnail or {@code null} */ public Thumbnail getThumbnailThumbnail() { byte[] data = getThumbnail(); if (data == null) { return null; } return new Thumbnail(data); }
/** * <p>Returns an <code>int</code> representing the Clipboard * Format</p> * * <p>Will throw an exception if the Thumbnail's Clipboard Format * Tag is not {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS}.</p> * * <p>Possible return values are:</p> * * <ul> * <li>{@link #CF_METAFILEPICT CF_METAFILEPICT}</li> * <li>{@link #CF_DIB CF_DIB}</li> * <li>{@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li> * <li>{@link #CF_BITMAP CF_BITMAP}</li> * </ul> * * @return a flag indicating the Clipboard Format * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS */ public long getClipboardFormat() throws HPSFException { if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); return LittleEndian.getInt(getThumbnail(), OFFSET_CF); }
static byte[] process(File docFile) throws Exception { final HWPFDocumentCore wordDocument = AbstractWordUtils.loadDoc(docFile); SummaryInformation summaryInformation = wordDocument.getSummaryInformation(); System.out.println(summaryInformation.getAuthor()); System.out.println(summaryInformation.getApplicationName() + ":" + summaryInformation.getTitle()); Thumbnail thumbnail = new Thumbnail(summaryInformation.getThumbnail()); System.out.println(thumbnail.getClipboardFormat()); System.out.println(thumbnail.getClipboardFormatTag()); return thumbnail.getThumbnailAsWMF(); }
/** * <p>Returns an <code>int</code> representing the Clipboard * Format Tag</p> * * <p>Possible return values are:</p> * <ul> * <li>{@link #CFTAG_WINDOWS CFTAG_WINDOWS}</li> * <li>{@link #CFTAG_MACINTOSH CFTAG_MACINTOSH}</li> * <li>{@link #CFTAG_FMTID CFTAG_FMTID}</li> * <li>{@link #CFTAG_NODATA CFTAG_NODATA}</li> * </ul> * * @return A flag indicating the Clipboard Format Tag */ public long getClipboardFormatTag() { return (long) LittleEndian.getInt(getThumbnail(), OFFSET_CFTAG); }
/** * <p>Returns an <code>int</code> representing the Clipboard * Format</p> * * <p>Will throw an exception if the Thumbnail's Clipboard Format * Tag is not {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS}.</p> * * <p>Possible return values are:</p> * * <ul> * <li>{@link #CF_METAFILEPICT CF_METAFILEPICT}</li> * <li>{@link #CF_DIB CF_DIB}</li> * <li>{@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li> * <li>{@link #CF_BITMAP CF_BITMAP}</li> * </ul> * * @return a flag indicating the Clipboard Format * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS */ public long getClipboardFormat() throws HPSFException { if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); return LittleEndian.getInt(getThumbnail(), OFFSET_CF); }
/** * <p>Returns an <code>int</code> representing the Clipboard * Format Tag</p> * * <p>Possible return values are:</p> * <ul> * <li>{@link #CFTAG_WINDOWS CFTAG_WINDOWS}</li> * <li>{@link #CFTAG_MACINTOSH CFTAG_MACINTOSH}</li> * <li>{@link #CFTAG_FMTID CFTAG_FMTID}</li> * <li>{@link #CFTAG_NODATA CFTAG_NODATA}</li> * </ul> * * @return A flag indicating the Clipboard Format Tag */ public long getClipboardFormatTag() { return (long) LittleEndian.getInt(getThumbnail(), OFFSET_CFTAG); }
if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); if (!(getClipboardFormat() == CF_METAFILEPICT)) { throw new HPSFException("Clipboard Format of Thumbnail must " + "be CF_METAFILEPICT."); byte[] thumbnail = getThumbnail(); int wmfImageLength = thumbnail.length - OFFSET_WMFDATA; byte[] wmfImage = new byte[wmfImageLength];
/** * <p>Returns an <code>int</code> representing the Clipboard * Format</p> * * <p>Will throw an exception if the Thumbnail's Clipboard Format * Tag is not {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS}.</p> * * <p>Possible return values are:</p> * * <ul> * <li>{@link #CF_METAFILEPICT CF_METAFILEPICT}</li> * <li>{@link #CF_DIB CF_DIB}</li> * <li>{@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li> * <li>{@link #CF_BITMAP CF_BITMAP}</li> * </ul> * * @return a flag indicating the Clipboard Format * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS */ public long getClipboardFormat() throws HPSFException { if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); return LittleEndian.getUInt(getThumbnail(), OFFSET_CF); }
/** * <p>Returns an <code>int</code> representing the Clipboard * Format Tag</p> * * <p>Possible return values are:</p> * <ul> * <li>{@link #CFTAG_WINDOWS CFTAG_WINDOWS}</li> * <li>{@link #CFTAG_MACINTOSH CFTAG_MACINTOSH}</li> * <li>{@link #CFTAG_FMTID CFTAG_FMTID}</li> * <li>{@link #CFTAG_NODATA CFTAG_NODATA}</li> * </ul> * * @return A flag indicating the Clipboard Format Tag */ public long getClipboardFormatTag() { long clipboardFormatTag = LittleEndian.getUInt(getThumbnail(), OFFSET_CFTAG); return clipboardFormatTag; }
/** * Returns the thumbnail (or {@code null}), processed * as an object which is (largely) able to unpack the thumbnail * image data. * * @return The thumbnail or {@code null} */ public Thumbnail getThumbnailThumbnail() { byte[] data = getThumbnail(); if (data == null) { return null; } return new Thumbnail(data); }
if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); if (!(getClipboardFormat() == CF_METAFILEPICT)) { throw new HPSFException("Clipboard Format of Thumbnail must " + "be CF_METAFILEPICT."); byte[] thumbnail = getThumbnail(); int wmfImageLength = thumbnail.length - OFFSET_WMFDATA; byte[] wmfImage = new byte[wmfImageLength];
/** * <p>Returns an <code>int</code> representing the Clipboard * Format</p> * * <p>Will throw an exception if the Thumbnail's Clipboard Format * Tag is not {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS}.</p> * * <p>Possible return values are:</p> * * <ul> * <li>{@link #CF_METAFILEPICT CF_METAFILEPICT}</li> * <li>{@link #CF_DIB CF_DIB}</li> * <li>{@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li> * <li>{@link #CF_BITMAP CF_BITMAP}</li> * </ul> * * @return a flag indicating the Clipboard Format * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS */ public long getClipboardFormat() throws HPSFException { if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); return LittleEndian.getUInt(getThumbnail(), OFFSET_CF); }
/** * <p>Returns an <code>int</code> representing the Clipboard * Format Tag</p> * * <p>Possible return values are:</p> * <ul> * <li>{@link #CFTAG_WINDOWS CFTAG_WINDOWS}</li> * <li>{@link #CFTAG_MACINTOSH CFTAG_MACINTOSH}</li> * <li>{@link #CFTAG_FMTID CFTAG_FMTID}</li> * <li>{@link #CFTAG_NODATA CFTAG_NODATA}</li> * </ul> * * @return A flag indicating the Clipboard Format Tag */ public long getClipboardFormatTag() { long clipboardFormatTag = LittleEndian.getUInt(getThumbnail(), OFFSET_CFTAG); return clipboardFormatTag; }
if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) throw new HPSFException("Clipboard Format Tag of Thumbnail must " + "be CFTAG_WINDOWS."); if (!(getClipboardFormat() == CF_METAFILEPICT)) { throw new HPSFException("Clipboard Format of Thumbnail must " + "be CF_METAFILEPICT."); byte[] thumbnail = getThumbnail(); int wmfImageLength = thumbnail.length - OFFSET_WMFDATA; byte[] wmfImage = new byte[wmfImageLength];