Class POIMetafileRenderer
java.lang.Object
org.apache.tika.renderer.microsoft.POIMetafileRenderer
- All Implemented Interfaces:
Serializable,SelfConfiguring,Renderer
Renders EMF and WMF images to a raster image through POI's HEMF and HWMF,
the way
PDFBoxRenderer renders PDF pages: at the RenderSettings
the parse scopes into the context (dpi, box, colour, format), else this
renderer's own, on a white canvas with the picture's aspect ratio; a canvas
over maxImagePixels is refused. Metafiles have no pages, so the
render requests are ignored and a single result is returned.
The WMF thumbnails that Word stores in the SummaryInformation of a .doc
consist of a window extent and a single dibStretchBlt record, for
which POI cannot compute bounds; those are rendered from the record's
bitmap directly.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSupportedTypes(ParseContext context) Returns the set of media types supported by this renderer when used with the given parse context.intgetWidth()The width the box allows when the parse scopes no settings; 800 by default.render(TikaInputStream tis, Metadata metadata, ParseContext parseContext, RenderRequest... requests) Renders the metafile in the stream, or theHemfPictureorHwmfPictureset as the stream's open container.voidsetImageFormatName(String imageFormatName) Deprecated.voidsetWidth(int width) Deprecated.since 4.1.0: applies only to a directrender(org.apache.tika.io.TikaInputStream, org.apache.tika.metadata.Metadata, org.apache.tika.parser.ParseContext, org.apache.tika.renderer.RenderRequest...)call with noRenderSettingsin the context.
-
Field Details
-
RENDERED_BY
- See Also:
-
EMF
-
WMF
-
-
Constructor Details
-
POIMetafileRenderer
public POIMetafileRenderer()
-
-
Method Details
-
getSupportedTypes
Description copied from interface:RendererReturns the set of media types supported by this renderer when used with the given parse context.- Specified by:
getSupportedTypesin interfaceRenderer- Parameters:
context- parse context- Returns:
- immutable set of media types
-
render
public RenderResults render(TikaInputStream tis, Metadata metadata, ParseContext parseContext, RenderRequest... requests) throws IOException, TikaException Renders the metafile in the stream, or theHemfPictureorHwmfPictureset as the stream's open container. The metadata'sTikaCoreProperties.TYPEtells EMF from WMF when a stream is parsed; it defaults to EMF.- Specified by:
renderin interfaceRenderer- Throws:
IOExceptionTikaException
-
getWidth
public int getWidth()The width the box allows when the parse scopes no settings; 800 by default. -
setWidth
Deprecated.since 4.1.0: applies only to a directrender(org.apache.tika.io.TikaInputStream, org.apache.tika.metadata.Metadata, org.apache.tika.parser.ParseContext, org.apache.tika.renderer.RenderRequest...)call with noRenderSettingsin the context. The EMF/WMF parsers always scopepages.render(300 dpi of the drawing's physical size, grayscale PNG, unless the block says otherwise), which replaces this. Configure"pages": {"render": {"maxWidth": ...}}. -
getImageFormatName
-
setImageFormatName
Deprecated.since 4.1.0; seesetWidth(int):pages.render.imageFormat.
-
setWidth(int):pages.render.imageFormat.