com.qoppa.pdf
Class PDFRenderHints

java.lang.Object
  extended bycom.qoppa.pdf.PDFRenderHints

public class PDFRenderHints
extends Object

PDFRenderHints allows the application to change the default rendering hints used when rendering a document. The class initializes the default rendering hints to:



The default settings can be modified by the host application by calling PDFRenderHints.setRenderingHint or PDFRenderHints.setRenderingHints.

Author:
Qoppa Software

Constructor Summary
PDFRenderHints()
           
 
Method Summary
static void addSubstituteFont(String fontName, Font subFont)
          Registers a substitute font to use when a font in a PDF file is not embedded in the file and the font is not registered with the operating system.
static boolean getImageSmoothReduction()
          Returns the value of the image reduction hint.
static Object getRenderingHint(RenderingHints.Key key)
          Gets one rendering hint.
static RenderingHints getRenderingHints()
          Gets a copy of the rendering hints.
static Font getSubstitutefont(String fontName)
          Returns a substitute font, if one has been registered, for the given font name.
static boolean isImageSmoothReduction()
          Returns the value of the smooth image reduction hingt.
static void setCMYKProfile(ICC_Profile cmykProfile)
          Sets a custom CMYK profile to use when reading any CMYK color information.
static void setImageSmoothReduction(boolean imageSmoothReduction)
          This rendering hint tells the library whether to use a smooth image rescaling algorithm when reducing sizes.
static void setRenderingHint(RenderingHints.Key key, Object value)
          Sets one rendering hint.
static void setRenderingHints(RenderingHints hints)
          Sets the rendering hints.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFRenderHints

public PDFRenderHints()
Method Detail

setRenderingHints

public static void setRenderingHints(RenderingHints hints)
Sets the rendering hints. This method replaces all the rendering hints with the argument.

Parameters:
hints - The new rendering hints.

getRenderingHints

public static RenderingHints getRenderingHints()
Gets a copy of the rendering hints. This method returns a copy of all the rendering hints.

Returns:
The rendering hints.

setRenderingHint

public static void setRenderingHint(RenderingHints.Key key,
                                    Object value)
Sets one rendering hint. This method sets the value of a single rendering hint.

Parameters:
key - The rendering hint key.
value - The new value of the rendering hint.

getRenderingHint

public static Object getRenderingHint(RenderingHints.Key key)
Gets one rendering hint. This method returns the value of a rendering hint.

Parameters:
key - The rendering hint key.
Returns:
The value of the rendering hint.

isImageSmoothReduction

public static boolean isImageSmoothReduction()
Returns the value of the smooth image reduction hingt.

Returns:
The value of the smoot image reduction hint.

setImageSmoothReduction

public static void setImageSmoothReduction(boolean imageSmoothReduction)
This rendering hint tells the library whether to use a smooth image rescaling algorithm when reducing sizes. When this is on, reduced image quality is much higher but this has a significant performance hit, especially for large images.

Parameters:
imageSmoothReduction - true to use smooth rescaling, false to use standard rescaling.

getImageSmoothReduction

public static boolean getImageSmoothReduction()
Returns the value of the image reduction hint.

Returns:
Value of the image reduction hint.

setCMYKProfile

public static void setCMYKProfile(ICC_Profile cmykProfile)
Sets a custom CMYK profile to use when reading any CMYK color information. If the host application needs to have custom CMYK -> RGB conversion, it can call this method to set a custom profile.

Parameters:
cmykProfile - The new profile to use for CMYK color conversion

addSubstituteFont

public static void addSubstituteFont(String fontName,
                                     Font subFont)
Registers a substitute font to use when a font in a PDF file is not embedded in the file and the font is not registered with the operating system. By default, when a font is not embedded in a PDF file, the library looks to the list of fonts available in the operating system. If the font is not found, then the library will look at the substitute fonts for a name that matches.

Parameters:
fontName - The name of the font in the PDF file.
subFont - The substitute font to use when the font is not present in the PDF file or in the OS.

getSubstitutefont

public static Font getSubstitutefont(String fontName)
Returns a substitute font, if one has been registered, for the given font name.

Parameters:
fontName - The name of the font
Returns:
The substitute font