class PDDefaultAppearanceString
extends java.lang.Object
The default appearance string (DA) contains any graphics state or text state operators needed to establish the graphics state parameters, such as text size and colour, for displaying the field’s variable text. Only operators that are allowed within text objects shall occur in this string. Note: This class is not yet public, as its API is still unstable.
Modifier and Type | Field and Description |
---|---|
private static float |
DEFAULT_FONT_SIZE
The default font size used by Acrobat.
|
private PDResources |
defaultResources |
private PDFont |
font |
private PDColor |
fontColor |
private COSName |
fontName |
private float |
fontSize |
Constructor and Description |
---|
PDDefaultAppearanceString(COSString defaultAppearance,
PDResources defaultResources)
Constructor for reading an existing DA string.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
copyNeededResourcesTo(PDAppearanceStream appearanceStream)
Copies any needed resources from the document’s DR dictionary into the stream’s Resources
dictionary.
|
(package private) PDFont |
getFont()
Returns the font.
|
(package private) PDColor |
getFontColor()
Returns the font color
|
(package private) COSName |
getFontName()
Get the font name
|
float |
getFontSize()
Returns the font size.
|
private void |
processAppearanceStringOperators(byte[] content)
Processes the operators of the given content stream.
|
private void |
processOperator(Operator operator,
java.util.List<COSBase> operands)
This is used to handle an operation.
|
private void |
processSetFont(java.util.List<COSBase> operands)
Process the set font and font size operator.
|
private void |
processSetFontColor(java.util.List<COSBase> operands)
Process the font color operator.
|
(package private) void |
setFont(PDFont font)
Set the font.
|
(package private) void |
setFontColor(PDColor fontColor)
Set the font color.
|
(package private) void |
setFontName(COSName fontName)
Set the font name.
|
(package private) void |
setFontSize(float fontSize)
Set the font size.
|
(package private) void |
writeTo(PDPageContentStream contents,
float zeroFontSize)
Writes the DA string to the given content stream.
|
private static final float DEFAULT_FONT_SIZE
private final PDResources defaultResources
private COSName fontName
private PDFont font
private float fontSize
private PDColor fontColor
PDDefaultAppearanceString(COSString defaultAppearance, PDResources defaultResources) throws java.io.IOException
defaultResources
- DR entrydefaultAppearance
- DA entryjava.io.IOException
- If the DA could not be parsedprivate void processAppearanceStringOperators(byte[] content) throws java.io.IOException
content
- the content to parse.java.io.IOException
- if there is an error reading or parsing the content stream.private void processOperator(Operator operator, java.util.List<COSBase> operands) throws java.io.IOException
operator
- The operation to perform.operands
- The list of arguments.java.io.IOException
- If there is an error processing the operation.private void processSetFont(java.util.List<COSBase> operands) throws java.io.IOException
operands
- the font name and sizejava.io.IOException
- in case there are missing operators or the font is not within the resourcesprivate void processSetFontColor(java.util.List<COSBase> operands) throws java.io.IOException
operands
- the color componentsjava.io.IOException
- in case of the color components not matchingCOSName getFontName()
void setFontName(COSName fontName)
fontName
- the font name to use for resource lookupPDFont getFont()
void setFont(PDFont font)
font
- the font to use.public float getFontSize()
void setFontSize(float fontSize)
fontSize
- the font size.PDColor getFontColor()
void setFontColor(PDColor fontColor)
fontColor
- the fontColor to use.void writeTo(PDPageContentStream contents, float zeroFontSize) throws java.io.IOException
java.io.IOException
void copyNeededResourcesTo(PDAppearanceStream appearanceStream) throws java.io.IOException
java.io.IOException