Class 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 PageCountLimits.

    Since:
    jadice server 5.5.1.0
    • 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 optimization
        jpegQuality - 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
      • setTargetPageSize

        public void setTargetPageSize​(PDFImageOptimizationNode.PageSize targetPageSize)
        Sets the target page size (optional). If set to null 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 associated com.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.
        The package name of the worker class is the name of the Node's package with an appended ".worker".

        This behavior can be overridden in concrete subclasses.

        Overrides:
        getWorkerClassName in class Node
        Returns:
        the full qualified class name of the worker of this node.