Package com.levigo.jadice.server.pdf
Class PDFImageOptimizationNode
- java.lang.Object
-
- com.levigo.jadice.server.internal.NodeInternal
-
- com.levigo.jadice.server.Node
-
- com.levigo.jadice.server.pdf.PDFImageOptimizationNode
-
public class PDFImageOptimizationNode extends Node
A node for optimizing the size of a PDF with embedded images. This is achieved by resizing those embedded images whose resolution exceeds a given threshold.Its worker respects
PageCountLimit
s.- Since:
- jadice server 5.5.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PDFImageOptimizationNode.PageSize
Predefined values for the size of the resulting PDF document.-
Nested classes/interfaces inherited from class com.levigo.jadice.server.Node
Node.Cardinality
-
-
Field Summary
Fields Modifier and Type Field Description static float
MAX_JPEG_QUALITY
Maximal value allowed for JPEG image quality.static float
MIN_JPEG_QUALITY
Minimal value allowed for JPEG image quality.
-
Constructor Summary
Constructors Constructor Description PDFImageOptimizationNode()
Creates an instance of this class with a maximal resolution of 300 dpi and JPEG image quality of 0.75.PDFImageOptimizationNode(float maxResolution, float jpegQuality)
Creates an instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getJPEGQuality()
Gets the JPEG image quality.float
getMaxResolution()
Gets the maximal resolution an embedded image should have after optimization.PDFImageOptimizationNode.PageSize
getTargetPageSize()
Gets the target page size.String
getWorkerClassName()
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name.void
setJPEGQuality(float jpegQuality)
Sets the JPEG image quality.void
setMaxResolution(float maxResolution)
Sets the maximal resolution an embedded image should have after optimization.void
setTargetPageSize(PDFImageOptimizationNode.PageSize targetPageSize)
Sets the target page size (optional).-
Methods inherited from class com.levigo.jadice.server.Node
addTransportReceiver, appendSuccessor, apply, equals, getInputCardinality, getJob, getOutputCardinality, getPredecessors, getSubsidiaryNodes, getSuccessors, getTransportSender, getUUID, hashCode, initialize, prependPredecessor, remove, validateConfiguration
-
-
-
-
Field Detail
-
MIN_JPEG_QUALITY
public static final float MIN_JPEG_QUALITY
Minimal value allowed for JPEG image quality.- See Also:
- Constant Field Values
-
MAX_JPEG_QUALITY
public static final float MAX_JPEG_QUALITY
Maximal value allowed for JPEG image quality.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDFImageOptimizationNode
public PDFImageOptimizationNode()
Creates an instance of this class with a maximal resolution of 300 dpi and JPEG image quality of 0.75.
-
PDFImageOptimizationNode
public PDFImageOptimizationNode(float maxResolution, float jpegQuality)
Creates an instance of this class.- Parameters:
maxResolution
- the maximum resolution an embedded image should have after optimizationjpegQuality
- the quality of resized JPEG images- Throws:
IllegalArgumentException
- if jpegQuality < 0.0f or jpegQuality > 1.0f
-
-
Method Detail
-
getMaxResolution
public float getMaxResolution()
Gets the maximal resolution an embedded image should have after optimization.- Returns:
- the maximal resolution
-
setMaxResolution
public void setMaxResolution(float maxResolution)
Sets the maximal resolution an embedded image should have after optimization.- Parameters:
maxResolution
- the maximal resolution (must be greater zero)
-
getJPEGQuality
public float getJPEGQuality()
Gets the JPEG image quality.- Returns:
- the image quality
-
getTargetPageSize
public PDFImageOptimizationNode.PageSize getTargetPageSize()
Gets the target page size.- Returns:
- the target page size
-
setTargetPageSize
public void setTargetPageSize(PDFImageOptimizationNode.PageSize targetPageSize)
Sets the target page size (optional). If set tonull
the original page size will be used to calculate the image resolution.- Parameters:
targetPageSize
- target page size
-
setJPEGQuality
public void setJPEGQuality(float jpegQuality)
Sets the JPEG image quality.- Parameters:
jpegQuality
- the image quality- Throws:
IllegalArgumentException
- if jpegQuality < 0.0f or jpegQuality > 1.0f
-
getWorkerClassName
public String getWorkerClassName()
Description copied from class:Node
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name. By default, the worker class name is- The same as the node name with the trailing "Node" replaced by "Worker" if the node name ends in "Node"
- The node class name with an appended "Worker" otherwise.
This behavior can be overridden in concrete subclasses.
- Overrides:
getWorkerClassName
in classNode
- Returns:
- the full qualified class name of the worker of this node.
-
-