Class PopplerRenderer
java.lang.Object
org.apache.tika.renderer.pdf.poppler.PopplerRenderer
- All Implemented Interfaces:
Serializable,SelfConfiguring,Renderer
Renders PDF pages through Poppler's
pdftoppm, one call per page at the dpi the
RenderSettings the parse scoped (else this renderer's own) resolve to for that page:
the target dpi, lowered so the page fits the box and its long side stays within
maxScaleTo, never raised. A page over maxImagePixels is skipped with a
warning. Page sizes come from the PDDocument the parser leaves as the stream's open
container, else from a load of the file.
Poppler is pre-installed on most Linux distributions and is the fastest widely-available
PDF renderer. On macOS it can be installed via brew install poppler; on Windows via
MSYS2 or Chocolatey.
Configuration key: "poppler-renderer"
- Since:
- Apache Tika 4.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetDpi()intgetSupportedTypes(ParseContext context) Returns the set of media types supported by this renderer when used with the given parse context.intbooleanisGray()render(TikaInputStream tis, Metadata metadata, ParseContext parseContext, RenderRequest... requests) voidsetDpi(int dpi) Deprecated.voidsetGray(boolean gray) Deprecated.since 4.1.0; seesetDpi(int):pages.render.imageType.voidsetMaxScaleTo(int maxScaleTo) Longest side of a rendered page in pixels; 4096 by default, -1 for none.voidsetPdftoppmPath(String pdftoppmPath) Thepdftoppmexecutable;"pdftoppm"(on the path) by default.voidsetTimeoutMillis(int timeoutMillis) Timeout for onepdftoppmcall (one page); 120000 by default.
-
Constructor Details
-
PopplerRenderer
public PopplerRenderer()
-
-
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 - Specified by:
renderin interfaceRenderer- Throws:
IOExceptionTikaException
-
getPdftoppmPath
-
setPdftoppmPath
Thepdftoppmexecutable;"pdftoppm"(on the path) by default. -
getDpi
public int getDpi() -
setDpi
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. A parse always scopespages.render, which replaces this. Configure"pages": {"render": {"dpi": ...}}. -
isGray
public boolean isGray() -
setGray
Deprecated.since 4.1.0; seesetDpi(int):pages.render.imageType. -
getTimeoutMillis
public int getTimeoutMillis() -
setTimeoutMillis
public void setTimeoutMillis(int timeoutMillis) Timeout for onepdftoppmcall (one page); 120000 by default. -
getMaxScaleTo
public int getMaxScaleTo() -
setMaxScaleTo
public void setMaxScaleTo(int maxScaleTo) Longest side of a rendered page in pixels; 4096 by default, -1 for none.
-
render(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.