Package org.apache.tika.renderer
Class RenderSettings
java.lang.Object
org.apache.tika.renderer.RenderSettings
- All Implemented Interfaces:
Serializable
How a document is rendered to pixels: the
"render" block of "pages". A
renderer reads the effective settings from the ParseContext
(class-keyed), scoped there by the parser around each render call.
dpi is the target; maxWidth/maxHeight is a ceiling: render at
dpi, scale down to fit if either bound is exceeded, aspect preserved, never enlarge.
maxImagePixels skips a page that would still be larger than that; minWidth/
minHeight skips one that would be smaller at the target dpi (a hairline rule, a spacer).
Every field is nullable so an instance can be an overlay: over(org.apache.tika.renderer.RenderSettings) applies the set
fields of one instance to another. defaults() has every field set.
- Since:
- Apache Tika 4.1
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbelowMinimum(double widthPoints, double heightPoints) True when the page rendered at the target dpi would be smaller than the minimum.copy()static RenderSettingsdefaults()300 dpi gray PNG at quality 0.5, at most 100 megapixels, no box, at least 2 x 2.floateffectiveDpi(double widthPoints, double heightPoints) The dpi a page of this size in points is rendered at: the target, reduced so the image fits the box, never raised.booleanlongestimatedPixels(double widthPoints, double heightPoints) Pixels of the page rendered ateffectiveDpi(double, double); whatmaxImagePixelsbounds.static longestimatedPixels(double widthPoints, double heightPoints, double dpi) Pixels of the page rendered at this dpi; saturates rather than overflowing.booleanexceedsMaxPixels(long pixels) True when an image of this many pixels exceedsmaxImagePixels.long[]fit(long width, long height) A pixel size scaled down to fit the box, aspect preserved, never enlarged: for renderers that start from a bitmap rather than a page size.getDpi()ImageIO's compression quality.inthashCode()over(RenderSettings overlay) A copy of this with every set field ofoverlayapplied; null overlay is this.voidvoidsetImageFormat(ImageFormat imageFormat) voidsetImageQuality(Float imageQuality) voidsetImageType(ImageType imageType) voidsetMaxHeight(Integer maxHeight) voidsetMaxImagePixels(Long maxImagePixels) A page that would still be larger than this after the box is skipped; -1 for no limit.voidsetMaxWidth(Integer maxWidth) Widest the image may be, in pixels; scaled down to fit, never enlarged; -1 for no bound.voidsetMinHeight(Integer minHeight) voidsetMinWidth(Integer minWidth) Narrower than this at the target dpi and the document is not rendered at all; 0 for none.
-
Field Details
-
NO_LIMIT
public static final int NO_LIMIT- See Also:
-
-
Constructor Details
-
RenderSettings
public RenderSettings()
-
-
Method Details
-
defaults
300 dpi gray PNG at quality 0.5, at most 100 megapixels, no box, at least 2 x 2. -
over
A copy of this with every set field ofoverlayapplied; null overlay is this. -
copy
-
equals
-
hashCode
public int hashCode() -
effectiveDpi
public float effectiveDpi(double widthPoints, double heightPoints) The dpi a page of this size in points is rendered at: the target, reduced so the image fits the box, never raised. Fractional, so the box is met exactly. Requires every field set. -
belowMinimum
public boolean belowMinimum(double widthPoints, double heightPoints) True when the page rendered at the target dpi would be smaller than the minimum. -
estimatedPixels
public long estimatedPixels(double widthPoints, double heightPoints) Pixels of the page rendered ateffectiveDpi(double, double); whatmaxImagePixelsbounds. -
estimatedPixels
public static long estimatedPixels(double widthPoints, double heightPoints, double dpi) Pixels of the page rendered at this dpi; saturates rather than overflowing. -
exceedsMaxPixels
public boolean exceedsMaxPixels(long pixels) True when an image of this many pixels exceedsmaxImagePixels. -
fit
public long[] fit(long width, long height) A pixel size scaled down to fit the box, aspect preserved, never enlarged: for renderers that start from a bitmap rather than a page size. -
getDpi
-
setDpi
-
getImageType
-
setImageType
-
getImageFormat
-
setImageFormat
-
getImageQuality
ImageIO's compression quality. For PNG an inverted effort knob, not fidelity: 1.0 writes an uncompressed file, 0.0 spends ~10x the time of 0.5 for a few percent smaller output. -
setImageQuality
-
getMaxImagePixels
-
setMaxImagePixels
A page that would still be larger than this after the box is skipped; -1 for no limit. -
getMaxWidth
-
setMaxWidth
Widest the image may be, in pixels; scaled down to fit, never enlarged; -1 for no bound. -
getMaxHeight
-
setMaxHeight
-
getMinWidth
-
setMinWidth
Narrower than this at the target dpi and the document is not rendered at all; 0 for none. -
getMinHeight
-
setMinHeight
-