Skip to content

Configuration

Patrick Corless edited this page Jun 10, 2025 · 8 revisions

Dependencies

The maven central repo poms take care of all the needed dependencies. However if you are hand crafting the dependencies here is a break down of what does what.

Encryption Support

<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15on</artifactId>
</dependency>
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-ext-jdk15on</artifactId>
</dependency>
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcpkix-jdk15on</artifactId>
</dependency>

Embedded Font Support

<dependency>
    <groupId>org.apache.pdfbox</groupId>
    <artifactId>fontbox</artifactId>
</dependency>
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
</dependency>

Optimized Font Substitution

To improve rendering quality for documents which do not include embedded fonts it is suggest that the Ghostscripts fonts are installed to better support the standard 14 Adobe fonts.

Ghostscript, which are freely available at: https://sourceforge.net/projects/gs-fonts/files/gs-fonts/

Font installation procedure vary by platform. But once installed, the viewers font cache can cleared and re-scanned using the preference dialog.

Reading Fonts from the classpath

It may be desirable to bundles fonts with your application to aid in rendering fonts. This can be achieved with the following code:

// get an instance to the singleton FontManager
FontManager fontManager = FontManager.getInstance();
// read four fonts from the package fonts
fontManager.readFontPackage("fonts", Arrays.asList(
                new String[]{"CenturySchL-Bold.pfb",
                        "Dingbats.pfb",
                        "NimbusMonL-Bold.pfb",
                        "NimbusSanL-Bold.pfb"}));

TIFF/CCITTFAX Images

<dependency>
    <groupId>com.twelvemonkeys.imageio</groupId>
    <artifactId>imageio-tiff</artifactId>
</dependency>

JPEG2000 Images

<dependency>
    <groupId>org.apache.pdfbox</groupId>
    <artifactId>jbig2-imageio</artifactId>
</dependency>
<dependency>
    <groupId>com.github.jai-imageio</groupId>
    <artifactId>jai-imageio-jpeg2000</artifactId>
</dependency>

Embedded Font Support

ICEpdf 7.0.0 and onward uses the Apache FontBox library and can read all embedded fonts in the PDF specification. Font rendering in ICEpdf 7.0.0 is officially 100% open source and licensed under Apache 2.0. Earlier version of the library depended on a proprietary library that is no longer supported.

Rendering Options

The rendering core by default will preserve image quality and draw images as they were intended by the original author. The only exception to this rule will occur if the JVM does not have enough memory to load an image, at which time the rendering core will try to compensate by scaling the image to a smaller size in an attempt to display the image using a smaller memory foot print.

The imaging core can be configured to scale images. Image scaling in some cases can reduce the amount of memory used by the rendering core but can also results in a lose of image quality. The following table describes the three different types of images scaling available in the imaging core.

Summary of Image Scaling Configuration Properties

Property Value Description
org.icepdf.core.imageReference default Image proxy implementation, no image scaling takes place (Default).
org.icepdf.core.imageReference scaled Image proxy implementation but will also scale images with the intent of saving the amount of memory used to display an image. Images less then 1000 pixels in width are not scaled.
org.icepdf.core.imageReference mipmap Mipmap implementation and image proxy which will create a series of scaled images, displaying the smaller version at small zoom values and the larger image at large zoom values.
org.icepdf.core.imageReference smoothScaled SmoothScaled implementation will scale images slightly via a trilinear scaling process that softens the edges of the image improving readability of most CCITTFax images.
org.icepdf.core.imageReference blurred Blurred implementation slightly blures the image smoothing out some image types and produces output similar to ICEpdf.

Image Pool

The Image pool is a Map of the most recently used images. The pools size by default is setup to be 1/4 the heap size. So as the pool grows it will self trim to keep the memory foot print at the specified max. The max pool size can be specified by using the org.icepdf.core.views.imagePoolSize system property. The value is specified in MB. For system with a constrained memory foot print the image pool can also be turned off with the property org.icepdf.core.views.imagePoolEnabled=false, the default value is true.

Image Masking

Image masks are an image that is used to define transparent regions on a parent image. The masking image is often quite a bit larger then the parent image and as a result we scale by default the parent image to match the image mask. The process results in a higher quality image render but also uses significantly more memory. For systems with a constrained memory foot print the system property org.icepdf.core.imageMaskScale.quality=false can be used to scale the mask to the size of the smaller parent image and thus save memory but at the cost of image quality.

System Properties

Many system properties are available for configuring ICEpdf. They can be set programmatically or on the command line. Programmatically, the syntax is as follows:

System.getProperties().put("org.icepdf.core.imageReference", "scaled");

On the command line, the syntax is as follows:

java -Dorg.icepdf.core.imageReference=scaled ...

The Dynamic column indicates whether changing the value of the property at runtime has any effect. The possible values are:

No - has no effect at runtime Yes - always has effect at runtime new - a new instance of the class must be created to see the effect at runtime N/A - not applicable

Annotations Properties Type Description Dynamic
org.icepdf.core.views.page.annotation.textmarkup.highlight.color string Specifies the default color used to create a new highlight annotation. Default value is #ffff00.
org.icepdf.core.views.page.annotation.strikeOut.highlight.color string Specifies the default color used to create a new strike out annotation. Default value is #ff0000. No
org.icepdf.core.views.page.annotation.strikeOut.underline.color string Specifies the default color used to create a new underline annotation. Default value is #00ff00. No
org.icepdf.core.views.page.annotation.ink.line.color string Specifies the default color used to create a new ink annotation via the LinkAnnotationHandler. Default value is #00ff00. No
org.icepdf.core.views.page.annotation.line.stroke.color string Specifies the default stroke color used to create a new line annotation via the LineAnnotationHandler and LineArrowAnnotationHandler. Default value is #ff0000. No
org.icepdf.core.views.page.annotation.line.fill.color string Specifies the default fill color used to create a new square or circle annotation via the SquareAnnotationHandler and CircleArrowAnnotationHandler. Default value is #ffffff. No
org.icepdf.core.views.page.annotation.squareCircle.fill.color string Specifies the default fill color used to create a new square or circle annotation via the SquareAnnotationHandler and CircleArrowAnnotationHandler. Default value is #000000. No
org.icepdf.core.views.page.annotation.squareCircle.stroke.color string Specifies the default stroke color used to create a new square or circle annotation via the SquareAnnotationHandler and CircleArrowAnnotationHandler. Default value is #ff0000. No
org.icepdf.core.views.page.annotation.text.fill.color string Specifies the default fill color used to create a new text annotation. Default value is #ffff00. No
org.icepdf.core.views.page.annotation.freeText.font.color string Specifies the default font colour used to create a new free text annotation. Default value is #000000. No
org.icepdf.core.views.page.annotation.freeText.fill.color string Specifies the default fillcolor used to create a new free text annotation. Default value is #ffffff. No
org.icepdf.core.views.page.annotation.freeText.font.size int Specifies the default font size in points used to create a new free text annotation font. Default value is 24 No
org.icepdf.core.views.page.annotation.outline.color string Specifies the default color used to draw annotations with invisible borders. Default value is #CCCCCC. No
org.icepdf.core.views.page.annotation.outlineResize.color string Specifies the default color used when drawing the resize squares on an annotation's border. Default value is #ffffff. No
Encryption Properties Type Description Dynamic
rg.icepdf.core.security.jceProvider string Specifies the classname of the security provider to use for encrypted documents. The provider must be Sun Java JCE 1.2.1 compliant.Default value is org.bouncycastle.jce.provider.BouncyCastleProvider. No
Imaging Properties Type Description Dynamic
org.icepdf.core.imageReference String sets the default image reference type. Possible values are; 'default', 'scaled' and 'mipmap'. Default value is 'default'. No
org.icepdf.core.ccittfax.jai boolean If true, JAI will be used to decode CCITTFAX images. Otherwise ICEpdf code will be used to decode CCITTFAX images. Default value is false. No
org.icepdf.core.imageProxy boolean If true, image will be loaded on as separate thread when the page is initialized. If false the prox will be disabled and images will be loaded on the same thread doing the page parse. Default value is true. No
Page View Buffer Properties Type Description Dynamic
org.icepdf.core.views.buffersize.vertical string Sets the vertical ratio that the current viewport height will be multiplied by to create a screen buffer. The default value is 1.0. Using a larger ratio will increase the amount of memory needed by the page view. No
org.icepdf.core.views.buffersize.horizontal string Sets the horizontal ratio that the current viewport width will be multiplied by to create a screen buffer. The default value is 1.0. Using a larger ratio will increase the amount of memory needed by the page view. No
org.icepdf.core.views.refreshfrequency integer Specifies the interval between refreshes of the view buffer when content is being rendered. The default value is 250 milliseconds. No
org.icepdf.core.views.dirtytimer.interval integer Specifies the interval in which a test for a dirty buffer will be executed and consequently when a repaint will occur. The default value is 5 milliseconds. No
org.icepdf.core.annotations.interactive.enabled boolean If true, link annotation actions can be activated using the system mouse. Default value is true. No
Page Decorator Properties Type Description Dynamic
org.icepdf.core.views.page.paper.color string Default page paper color before PDF content is painted. Default color value is #FFFFFF. No
org.icepdf.core.views.page.border.color string Default page border color. Default color value is #000000. No
org.icepdf.core.views.page.shadow.color string Default page shadow color. Default color value is #333333. No
org.icepdf.core.views.background.color string Default color value is #808080. No
org.icepdf.core.views.page.proxy boolean If true the page view component will load and paint the page content using two different theads. If false the page is loaded on the AWT thread. Default value true. No
Text extraction Properties Type Description Dynamic
org.icepdf.core.views.page.text.spaceFraction integer Sets the heuristic used to detect if a space should be inserted between two characters. The value is converted to 1/spaceFraction and is multiplied by the average character width. higher values will insert more space and lower values less space. Default value is 3. No
Text selection Properties Type Description Dynamic
org.icepdf.core.views.page.text.selectionColor string Sets the color used for text selection painting. Default color value is #0077FF. No
org.icepdf.core.views.page.text.highlightColor string Sets the color used for search highlight painting. Default color value is #FFF600. No
Threading Properties Type Description Dynamic
org.icepdf.core.library.threadPoolSize integer Sets the max number of threads that ICEpdf can use for its common thread pool executor. The common thread pool is used to initial Page content in the Viewer RI. Default value is 3. No
org.icepdf.core.library.painterThreadPoolSize integer Sets the max number of threads that ICEpdf can use when painting pages in the Viewer RI PageViewComponentImpl. Default value is 1. No
org.icepdf.core.library.imageThreadPoolSize integer Sets the max number of threads that ICEpdf can use when proxying image loading work during page parsing. Default value is 5. No

Note: For the Rendering Quality properties below, target can be set for both print and screen. For dynamic changes to these System Properties to take effect, you must call org.icepdf.core.util.GraphicsRenderingHints.reset().

Rendering Quality Properties Type Description Dynamic
org.icepdf.core.awtFontLoading boolean When enabled the java.awt.Font will be used to try and load embedded font files. Default value is false. Has no effect on ICEpdf Pro. No
org.icepdf.core.paint.disableAlpha boolean If true, all alpha or transparency painting will be suspended. This property can be enabled when printing with in the intension of reducing the spool size. Yes
org.icepdf.core.paint.disableClipping boolean If true, all clipping will be suspended. This property should only be used if content is missing from printed output. This property can be turned on for printing and turned off once the print job has finished. Yes
org.icepdf.core.target.alphaInterpolation string Sets the JVM's alpha interpolation rendering hint. The default value for print is VALUE_INTERPOLATION_QUALITY. The default value for screen is VALUE_INTERPOLATION_QUALITY. The other supported value is VALUE_ALPHA_INTERPOLATION_ DEFAULT Yes
org.icepdf.core.target.antiAliasing string Sets the JVM's antialiasing of all images and text. The default value for print and screen is VALUE_ANTIALIAS_ON. Other supported values are VALUE_ANTIALIAS_DEFAULT and VALUE_ANTIALIAS_OFF. Yes
org.icepdf.core.target.background string Sets whether a Page will draw a background fill colour before drawing the Page contents. According to the PDF standard, a white background should be drawn. When printing on white paper, for some printers with poor drivers, it is best to not draw a background at all. The default value is VALUE_DRAW_WHITE_BACKGROUND. The other supported value is VALUE_DRAW_NO_BACKGROUND. Yes
org.icepdf.core.target.colorRender string Sets the JVM's color render rendering hint. The default value for print and screen is VALUE_COLOR_RENDER_QUALITY. The other supported values are VALUE_COLOR_RENDER_DEFAULT. Yes
org.icepdf.core.target.dither string Sets the JVM's dither rendering hint. The default value for print and screen is VALUE_DITHER_ENABLE. Other supported values are VALUE_DITHER_DEFAULT and VALUE_DITHER_DISABLE. Yes
org.icepdf.core.target. fractionalmetrics string Sets the JVM's fractional metrics rendering hint. The default value for print and screen is VALUE_FRACTIONALMETRICS_ON. Other supported values are VALUE_FRACTIONALMETRICS_DEFAULT and VALUE_FRACTIONALMETRICS_OFF. Yes
org.icepdf.core.target. interpolation string Sets the JVM's interpolation rendering hint. The default value for print and screen is VALUE_INTERPOLATION_BICUBIC. The other supported values are VALUE_INTERPOLATION_BILINEAR and VALUE_INTERPOLATION_NEAREST_ NEIGHBOR. Yes
org.icepdf.core.target.render string Sets the JVM's render rendering hint. The default value for print and screen is VALUE_RENDER_QUALITY. The other supported values are VALUE_RENDER_DEFAULT and VALUE_RENDER_SPEED Yes
org.icepdf.core.target.stroke string Sets the JVM's stroke rendering hint. The default value for print and screen is VALUE_STROKE_NORMALIZE.The other supported values are VALUE_STROKE_PURE and VALUE_STROKE_DEFAULT. Yes
org.icepdf.core.target. textAntiAliasing string Sets the Font rendering engine's antialiasing rendering hint. The default value is true. The other supported value is false. Yes