Package org.apache.pdfbox.pdmodel.fdf
Class FDFIconFit
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.fdf.FDFIconFit
-
- All Implemented Interfaces:
COSObjectable
public class FDFIconFit extends java.lang.Object implements COSObjectable
This represents an Icon fit dictionary for an FDF field.
-
-
Field Summary
Fields Modifier and Type Field Description private COSDictionary
fit
static java.lang.String
SCALE_OPTION_ALWAYS
A scale option.static java.lang.String
SCALE_OPTION_NEVER
A scale option.static java.lang.String
SCALE_OPTION_ONLY_WHEN_ICON_IS_BIGGER
A scale option.static java.lang.String
SCALE_OPTION_ONLY_WHEN_ICON_IS_SMALLER
A scale option.static java.lang.String
SCALE_TYPE_ANAMORPHIC
Scale to fill with of annotation, disregarding aspect ratio.static java.lang.String
SCALE_TYPE_PROPORTIONAL
Scale to fit width or height, smaller of two, while retaining aspect ration.
-
Constructor Summary
Constructors Constructor Description FDFIconFit()
Default constructor.FDFIconFit(COSDictionary f)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description COSDictionary
getCOSObject()
Convert this standard java object to a COS object.PDRange
getFractionalSpaceToAllocate()
This is guaranteed to never return null.
To quote the PDF Spec "An array of two numbers between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left and bottom of the icon.java.lang.String
getScaleOption()
This will get the scale option.java.lang.String
getScaleType()
This will get the scale type.void
setFractionalSpaceToAllocate(PDRange space)
This will set frational space to allocate.void
setScaleOption(java.lang.String option)
This will set the scale option for the icon.void
setScaleToFitAnnotation(boolean value)
This will tell the icon to scale.void
setScaleType(java.lang.String scale)
This will set the scale type.boolean
shouldScaleToFitAnnotation()
This will tell if the icon should scale to fit the annotation bounds.
-
-
-
Field Detail
-
fit
private COSDictionary fit
-
SCALE_OPTION_ALWAYS
public static final java.lang.String SCALE_OPTION_ALWAYS
A scale option.- See Also:
- Constant Field Values
-
SCALE_OPTION_ONLY_WHEN_ICON_IS_BIGGER
public static final java.lang.String SCALE_OPTION_ONLY_WHEN_ICON_IS_BIGGER
A scale option.- See Also:
- Constant Field Values
-
SCALE_OPTION_ONLY_WHEN_ICON_IS_SMALLER
public static final java.lang.String SCALE_OPTION_ONLY_WHEN_ICON_IS_SMALLER
A scale option.- See Also:
- Constant Field Values
-
SCALE_OPTION_NEVER
public static final java.lang.String SCALE_OPTION_NEVER
A scale option.- See Also:
- Constant Field Values
-
SCALE_TYPE_ANAMORPHIC
public static final java.lang.String SCALE_TYPE_ANAMORPHIC
Scale to fill with of annotation, disregarding aspect ratio.- See Also:
- Constant Field Values
-
SCALE_TYPE_PROPORTIONAL
public static final java.lang.String SCALE_TYPE_PROPORTIONAL
Scale to fit width or height, smaller of two, while retaining aspect ration.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FDFIconFit
public FDFIconFit()
Default constructor.
-
FDFIconFit
public FDFIconFit(COSDictionary f)
Constructor.- Parameters:
f
- The icon fit dictionary.
-
-
Method Detail
-
getCOSObject
public COSDictionary getCOSObject()
Convert this standard java object to a COS object.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The cos object that matches this Java object.
-
getScaleOption
public java.lang.String getScaleOption()
This will get the scale option. See the SCALE_OPTION_XXX constants. This is guaranteed to never return null. Default: Always- Returns:
- The scale option.
-
setScaleOption
public void setScaleOption(java.lang.String option)
This will set the scale option for the icon. Set the SCALE_OPTION_XXX constants.- Parameters:
option
- The scale option.
-
getScaleType
public java.lang.String getScaleType()
This will get the scale type. See the SCALE_TYPE_XXX constants. This is guaranteed to never return null. Default: Proportional- Returns:
- The scale type.
-
setScaleType
public void setScaleType(java.lang.String scale)
This will set the scale type. See the SCALE_TYPE_XXX constants.- Parameters:
scale
- The scale type.
-
getFractionalSpaceToAllocate
public PDRange getFractionalSpaceToAllocate()
This is guaranteed to never return null.
To quote the PDF Spec "An array of two numbers between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left and bottom of the icon. A value of [0.0 0.0] positions the icon at the bottom-left corner of the annotation rectangle; a value of [0.5 0.5] centers it within the rectangle. This entry is used only if the icon is scaled proportionally. Default value: [0.5 0.5]."- Returns:
- The fractional space to allocate.
-
setFractionalSpaceToAllocate
public void setFractionalSpaceToAllocate(PDRange space)
This will set frational space to allocate.- Parameters:
space
- The space to allocate.
-
shouldScaleToFitAnnotation
public boolean shouldScaleToFitAnnotation()
This will tell if the icon should scale to fit the annotation bounds. Default: false- Returns:
- A flag telling if the icon should scale.
-
setScaleToFitAnnotation
public void setScaleToFitAnnotation(boolean value)
This will tell the icon to scale.- Parameters:
value
- The flag value.
-
-