com.qoppa.pdf
Class PDFRenderHints

java.lang.Object
  extended by com.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

Field Summary
static int CHINESE_SANSSERIF
           
static int CHINESE_SERIF
           
static int CHINESE_SIMPLIFIED
           
static int JAPANESE_SANSSERIF
           
static int JAPANESE_SERIF
           
static int KOREAN_SANSSERIF
           
static int KOREAN_SERIF
           
 
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 String getCJKSystemFontName(int cjkFontType)
          Get the name of the system font that will be used to render non-embedded instances of the CJK font type indicated by cjkFontType
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)
          Deprecated. Use getSubstituteFont instead
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 boolean isRenderComments()
          Returns the value of the render comments flag.
static boolean renderSignatureTag()
          This method returns the value of the flag that controls rendering of the signature tag on empty fields.
static boolean renderSignatureVerify()
          This method returns the value of the flag that controls whether signature verification will be rendered.
static void setCJKSystemFontName(int cjkFontType, String systemFontName)
          Set the local system font systemFontName to use for a particular CJK font type cjkFontType
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 setRenderComments(boolean renderComments)
          Sets a flag to tell the library to render annotations.
static void setRenderingHint(RenderingHints.Key key, Object value)
          Sets one rendering hint.
static void setRenderingHints(RenderingHints hints)
          Sets the rendering hints.
static void setRenderSignatureTag(boolean renderSignatureTag)
          This method sets the value of the flag that controls whether the signature tag ("Sign Here") is rendered for empty signature fields.
static void setRenderSignatureVerification(boolean renderSignatureVerify)
          This method sets the value of the flag that controls whether signature verification will be rendered.
static void setUseSubstituteFont(boolean useSubstitute)
          Tells the rendering engine to use a substitute font when a font in the PDF cannot be created for any reasons.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAPANESE_SERIF

public static final int JAPANESE_SERIF
See Also:
Constant Field Values

JAPANESE_SANSSERIF

public static final int JAPANESE_SANSSERIF
See Also:
Constant Field Values

CHINESE_SERIF

public static final int CHINESE_SERIF
See Also:
Constant Field Values

CHINESE_SANSSERIF

public static final int CHINESE_SANSSERIF
See Also:
Constant Field Values

CHINESE_SIMPLIFIED

public static final int CHINESE_SIMPLIFIED
See Also:
Constant Field Values

KOREAN_SERIF

public static final int KOREAN_SERIF
See Also:
Constant Field Values

KOREAN_SANSSERIF

public static final int KOREAN_SANSSERIF
See Also:
Constant Field Values
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)
Deprecated. Use getSubstituteFont instead

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

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

setUseSubstituteFont

public static void setUseSubstituteFont(boolean useSubstitute)
Tells the rendering engine to use a substitute font when a font in the PDF cannot be created for any reasons. This includes that the font is not embedded and cannot be found in the OS, or that there is an error in the embedded font.

Parameters:
useSubstitute - Flag indicating whether a substitute font should be used.

renderSignatureVerify

public static boolean renderSignatureVerify()
This method returns the value of the flag that controls whether signature verification will be rendered. When this flag is true, the renderer will show an icon on the signature field representing the results of the signature verification.

Returns:
The value of the flag that controls rendering of signature verification

setRenderSignatureVerification

public static void setRenderSignatureVerification(boolean renderSignatureVerify)
This method sets the value of the flag that controls whether signature verification will be rendered. When this flag is true, the renderer will show an icon on the signature field representing the results of the signature verification.

Parameters:
renderSignatureVerify - The new value of the flag

setRenderSignatureTag

public static void setRenderSignatureTag(boolean renderSignatureTag)
This method sets the value of the flag that controls whether the signature tag ("Sign Here") is rendered for empty signature fields.

Parameters:
renderSignatureTag - The new value of the flag.

renderSignatureTag

public static boolean renderSignatureTag()
This method returns the value of the flag that controls rendering of the signature tag on empty fields. The signature tag is an icon with the a caption like "Sign Here"

Returns:
The current value of the render signature tag flag.

setRenderComments

public static void setRenderComments(boolean renderComments)
Sets a flag to tell the library to render annotations. When this is set to false, pages in documents will not be rendered with their comments.

Parameters:
renderComments - New value of the flag.

isRenderComments

public static boolean isRenderComments()
Returns the value of the render comments flag.

Returns:
The value of the render comments flag.

setCJKSystemFontName

public static void setCJKSystemFontName(int cjkFontType,
                                        String systemFontName)
Set the local system font systemFontName to use for a particular CJK font type cjkFontType

Parameters:
cjkFontType - the integer code for a particular CJK font type, e.g. Chinese Serif
systemFontName - should either match one of the font names returned by GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() or else it should be null. If systemFontName matches a system font family name, then that font will be used to render non-embedded instances of cjkFontType. If systemFontName is null, then that resets the font for cjkFontType to the default value, which may be none on some systems. If systemFontName is any other value, then the call has no affect.

getCJKSystemFontName

public static String getCJKSystemFontName(int cjkFontType)
Get the name of the system font that will be used to render non-embedded instances of the CJK font type indicated by cjkFontType

Parameters:
cjkFontType - the integer code for a particular CJK font type, e.g. Chinese Serif
Returns:
Returns the name of the system font that will be used to render non-embedded instances of the CJK font type indicated by cjkFontType. Returns null if no system font has been set and if no default font names were found on the local system. A null result implies non-embedded instances of cjkFontType will not be rendered correctly.