TIKA-4855: Render EMF/WMF through POI and emit the OLE2 SummaryInformation thumbnail - #3095
Open
dschmidt wants to merge 7 commits into
Open
TIKA-4855: Render EMF/WMF through POI and emit the OLE2 SummaryInformation thumbnail#3095dschmidt wants to merge 7 commits into
dschmidt wants to merge 7 commits into
Conversation
…mation thumbnail
POIMetafileRenderer (poi-metafile-renderer) draws EMF and WMF images to a
PNG of a configurable width; Word's bitmap-in-WMF thumbnails, which POI has
no bounds for, are rendered from the bitmap. EMFParser and WMFParser are
RenderingParsers and emit the rendering as a RENDERING embedded document
with "emf-parser" / "wmf-parser": {"renderImage": true}, off by
default, the way the PDF parser emits page renderings. OfficeParser emits
the SummaryInformation thumbnail of the OLE2 formats (a WMF) as a THUMBNAIL
embedded document, as the OOXML parsers do with the docProps thumbnail.
dschmidt
force-pushed
the
metafile-rendering
branch
from
August 29, 2026 12:22
5cafd74 to
e966adc
Compare
…o e.g. thumbnails With "renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] the parsers render the document's thumbnail but not the metafiles of embedded objects or pictures; empty (the default) renders every image.
# Conflicts: # CHANGES.txt
# Conflicts: # CHANGES.txt
dschmidt
marked this pull request as ready for review
August 30, 2026 11:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Office documents carry their preview image as a vector metafile: the OOXML
docProps/thumbnail.emfof Word (an EMF wrapping a WMF) andthumbnail.wmfof Excel, and the SummaryInformation thumbnail (PIDSI_THUMBNAIL,CF_METAFILEPICT, a WMF) of the OLE2 formats. Neither is usable as a preview outside Windows, and outside the JVM there is no maintained EMF/WMF rasterizer, while POI's HEMF/HWMF can draw both.Following the PDF parser's rendering design:
POIMetafileRenderer(poi-metafile-renderer) is aRendererforimage/emfandimage/wmf: the POI picture drawn onto a white canvas, a PNG of a configurable width. The WMF thumbnails Word writes consist of asetWindowExtand adibStretchBltrecord only, for which POI cannot compute bounds; those are rendered from the record's bitmap.EMFParserandWMFParserimplementRenderingParserand, with"emf-parser"/"wmf-parser": {"renderImage": true, "renderWidth": 800}(off by default), emit the rendering as aRENDERINGembedded document named after the image. An injected renderer is used when it supports the type, the POI one otherwise. The shared config and emission live inMetafileParserConfigandMetafileRendering.OfficeParseremits the SummaryInformation thumbnail as aTHUMBNAILembedded document (image/wmf,thumbnail.wmf), consistent with the docProps thumbnail of the OOXML parsers. Two PowerPoint tests count one embedded document more because of it.Verified against tika-server with
/unpack: docx, xlsx, doc, xls and ppt files that carry a thumbnail yield it at depth 1 and its PNG rendering at depth 2.https://issues.apache.org/jira/browse/TIKA-4855