Class Configuration

java.lang.Object
org.openpdf.renderer.Configuration

public class Configuration extends Object
Since there is no context that is passed between the various classes that perform the pdf parsing and rendering, we introduce this class to at least globally configure PDFRenderer. Typically you would configure the global instance before using any other PDFRenderer API.
  • Field Details

    • INSTANCE

      private static Configuration INSTANCE
    • convertGreyscaleImagesToArgb

      private boolean convertGreyscaleImagesToArgb
      whether grey scale images will be converted to ARGB
    • thresholdForBandedImageRendering

      private int thresholdForBandedImageRendering
      threshold in pixels after which images are rendered in chunks (disabled by default)
    • avoidColorConvertOp

      private boolean avoidColorConvertOp
      whether color convert op should be used or not for parsing an image
    • useBlurResizingForImages

      private boolean useBlurResizingForImages
      Use blur before image resize to enhance the result (Antialias)
    • printSigantureFields

      private boolean printSigantureFields
      Print signature fields on pdf
    • printStampAnnotations

      private boolean printStampAnnotations
      Print stamp annotations on pdf
    • printWidgetAnnotations

      private boolean printWidgetAnnotations
      Print widget annotations on pdf
    • printFreetextAnnotations

      private boolean printFreetextAnnotations
      Print freetext annotations on pdf
    • printLinkAnnotations

      private boolean printLinkAnnotations
      Print link annotations on pdf
  • Constructor Details

    • Configuration

      public Configuration()
  • Method Details

    • getInstance

      public static Configuration getInstance()
    • setConvertGreyscaleImagesToArgb

      public void setConvertGreyscaleImagesToArgb(boolean aFlag)
      Enables or disables the conversion of greyscale images to ARGB. Disabling this may have a lower memory overhead with high resolution (e.g. scanned) images. Note that this has to be called before
      invalid reference
      #getImage()
      is called to have an effect. Enabled by default.
      Parameters:
      aFlag - whether greyscale images shall be converted to ARGB.
    • isConvertGreyscaleImagesToArgb

      public boolean isConvertGreyscaleImagesToArgb()
      Returns true if greyscale images will be converted to ARGB
    • setThresholdForBandedImageRendering

      public void setThresholdForBandedImageRendering(int aSize)
      If an image is higher than the given size (in pixels) then the image will be rendered in chunks, rather than as one big image. This may lead to lower memory consumption for e.g. scanned PDFs with large images. Set to a value invalid input: '<'= 0 to disable banded image rendering. Defaults to 0 (off)
      Parameters:
      aSize - the height threshold at which to enable banded image rendering
    • getThresholdForBandedImageRendering

      public int getThresholdForBandedImageRendering()
      Returns the image height threshold at which to enable banded image rendering.
      Returns:
      the threshold value, or a value invalid input: '<'= 0 if banded rendering is disabled
    • isAvoidColorConvertOp

      public boolean isAvoidColorConvertOp()
      Is the color converting op switched on or off?
      Returns:
      - the usage of this color convert op
    • setAvoidColorConvertOp

      public void setAvoidColorConvertOp(boolean avoidColorConvertOp)
      Set this to false to switch off the use of this color convert op which may segfault on some platforms due to a variety of problems related to thread safety and the native cmm library underlying this conversion op, e.g., https://forums.oracle.com/forums/thread.jspa?threadID=1261882invalid input: '&';tstart=225invalid input: '&messageID'=5356357 (Unix platforms seem the most affected) If the system is bug-free, though, this does make use of native libraries and sees a not insignificant speed-up, though it's still not exactly fast. If we don't run this op now, it's performed at some later stage, but without using the native code
      Parameters:
      avoidColorConvertOp -
    • isUseBlurResizingForImages

      public boolean isUseBlurResizingForImages()
      Use blur before image resize to enhance the result (Antialias)?
      Returns:
      the useBlurResizingForImages
    • setUseBlurResizingForImages

      public void setUseBlurResizingForImages(boolean useBlurResizingForImages)
      Use blur before image resize to enhance the result (Antialias)
      Parameters:
      useBlurResizingForImages -
    • setPrintSignatureFields

      public void setPrintSignatureFields(boolean printSignatureFields)
      Print signature fields on pdf
      Parameters:
      printSignatureField -
    • isPrintSignatureFields

      public boolean isPrintSignatureFields()
      Returns:
      true if signature fields will be printed on pdf
    • setPrintStampAnnotations

      public void setPrintStampAnnotations(boolean printStampAnnotations)
      Print stamp annotations on pdf
      Parameters:
      printStampAnnotation -
    • isPrintStampAnnotations

      public boolean isPrintStampAnnotations()
      Returns:
      true if stamp annotations will be printed on pdf
    • setPrintWidgetAnnotations

      public void setPrintWidgetAnnotations(boolean printWidgetAnnotations)
      Print widget annotations on pdf
      Parameters:
      printWidgetAnnotations -
    • isPrintWidgetAnnotations

      public boolean isPrintWidgetAnnotations()
      Returns:
      true if widget annotations will be printed on pdf
    • setPrintFreetextAnnotations

      public void setPrintFreetextAnnotations(boolean printFreetextAnnotations)
      Print freetext annotations on pdf
      Parameters:
      printFreetextAnnotations -
    • isPrintFreetextAnnotations

      public boolean isPrintFreetextAnnotations()
      Returns:
      true if freetext annotations will be printed on pdf
    • setPrintLinkAnnotations

      public void setPrintLinkAnnotations(boolean printLinkAnnotations)
      Print link annotations on pdf
      Parameters:
      printLinkAnnotations -
    • isPrintLinkAnnotations

      public boolean isPrintLinkAnnotations()
      Returns:
      true if link annotations will be printed on pdf