public abstract class PDAbstractAppearanceHandler extends java.lang.Object implements PDAppearanceHandler
Modifier and Type | Field and Description |
---|---|
protected static java.util.Set<java.lang.String> |
ANGLED_STYLES
Line ending styles where the shape changes its angle, e.g.
|
private PDAnnotation |
annotation |
(package private) static double |
ARROW_ANGLE |
protected PDDocument |
document |
protected static java.util.Set<java.lang.String> |
INTERIOR_COLOR_STYLES
Line ending styles where there is an interior color.
|
protected static java.util.Set<java.lang.String> |
SHORT_STYLES
Line ending styles where the line has to be drawn shorter (minus line width).
|
Constructor and Description |
---|
PDAbstractAppearanceHandler(PDAnnotation annotation) |
PDAbstractAppearanceHandler(PDAnnotation annotation,
PDDocument document) |
Modifier and Type | Method and Description |
---|---|
(package private) PDRectangle |
addRectDifferences(PDRectangle rectangle,
float[] differences)
Get a rectangle enlarged by the differences.
|
(package private) PDRectangle |
applyRectDifferences(PDRectangle rectangle,
float[] differences)
Get a rectangle with the differences applied to each side.
|
private static java.util.Set<java.lang.String> |
createAngledStyles() |
protected COSStream |
createCOSStream() |
private static java.util.Set<java.lang.String> |
createInteriorColorStyles() |
private static java.util.Set<java.lang.String> |
createShortStyles() |
(package private) void |
drawArrow(PDAppearanceContentStream cs,
float x,
float y,
float len)
Add the two arms of a horizontal arrow.
|
(package private) void |
drawCircle(PDAppearanceContentStream cs,
float x,
float y,
float r)
Add a circle shape to the path in clockwise direction.
|
(package private) void |
drawCircle2(PDAppearanceContentStream cs,
float x,
float y,
float r)
Add a circle shape to the path in counterclockwise direction.
|
(package private) void |
drawDiamond(PDAppearanceContentStream cs,
float x,
float y,
float r)
Add a square diamond shape (corner on top) to the path.
|
(package private) void |
drawStyle(java.lang.String style,
PDAppearanceContentStream cs,
float x,
float y,
float width,
boolean hasStroke,
boolean hasBackground,
boolean ending)
Draw a line ending style.
|
(package private) PDAnnotation |
getAnnotation() |
(package private) PDAppearanceDictionary |
getAppearance()
Get the annotations appearance dictionary.
|
private PDAppearanceContentStream |
getAppearanceEntryAsContentStream(PDAppearanceEntry appearanceEntry,
boolean compress) |
(package private) PDColor |
getColor() |
(package private) PDAppearanceEntry |
getDownAppearance()
Get the annotations down appearance.
|
private PDAppearanceEntry |
getNormalAppearance()
Get the annotations normal appearance.
|
(package private) PDAppearanceContentStream |
getNormalAppearanceAsContentStream()
Get the annotations normal appearance content stream.
|
(package private) PDAppearanceContentStream |
getNormalAppearanceAsContentStream(boolean compress)
Get the annotations normal appearance content stream.
|
(package private) PDRectangle |
getPaddedRectangle(PDRectangle rectangle,
float padding)
Get a padded rectangle.
|
(package private) PDRectangle |
getRectangle() |
(package private) PDAppearanceEntry |
getRolloverAppearance()
Get the annotations rollover appearance.
|
(package private) PDRectangle |
handleBorderBox(PDAnnotationSquareCircle annotation,
float lineWidth) |
(package private) void |
setOpacity(PDAppearanceContentStream contentStream,
float opacity) |
private void |
setTransformationMatrix(PDAppearanceStream appearanceStream) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generateAppearanceStreams, generateDownAppearance, generateNormalAppearance, generateRolloverAppearance
private final PDAnnotation annotation
protected PDDocument document
protected static final java.util.Set<java.lang.String> SHORT_STYLES
static final double ARROW_ANGLE
protected static final java.util.Set<java.lang.String> INTERIOR_COLOR_STYLES
protected static final java.util.Set<java.lang.String> ANGLED_STYLES
public PDAbstractAppearanceHandler(PDAnnotation annotation)
public PDAbstractAppearanceHandler(PDAnnotation annotation, PDDocument document)
PDAnnotation getAnnotation()
PDColor getColor()
PDRectangle getRectangle()
protected COSStream createCOSStream()
PDAppearanceDictionary getAppearance()
This will get the annotations appearance dictionary. If this is not existent an empty appearance dictionary will be created.
PDAppearanceContentStream getNormalAppearanceAsContentStream() throws java.io.IOException
This will get the annotations normal appearance content stream, to 'draw' to. It will be uncompressed.
java.io.IOException
PDAppearanceContentStream getNormalAppearanceAsContentStream(boolean compress) throws java.io.IOException
This will get the annotations normal appearance content stream, to 'draw' to.
compress
- whether the content stream is to be compressed. Set this to true when
creating long content streams.java.io.IOException
PDAppearanceEntry getDownAppearance()
This will get the annotations down appearance. If this is not existent an empty appearance entry will be created.
PDAppearanceEntry getRolloverAppearance()
This will get the annotations rollover appearance. If this is not existent an empty appearance entry will be created.
PDRectangle getPaddedRectangle(PDRectangle rectangle, float padding)
Creates a new rectangle with padding applied to each side. .
rectangle
- the rectangle.padding
- the padding to apply.PDRectangle addRectDifferences(PDRectangle rectangle, float[] differences)
Creates a new rectangle with differences added to each side. If there are no valid differences, then the original rectangle is returned.
rectangle
- the rectangle.differences
- the differences to apply.PDRectangle applyRectDifferences(PDRectangle rectangle, float[] differences)
Creates a new rectangle with differences added to each side. If there are no valid differences, then the original rectangle is returned.
rectangle
- the rectangle.differences
- the differences to apply.void setOpacity(PDAppearanceContentStream contentStream, float opacity) throws java.io.IOException
java.io.IOException
void drawStyle(java.lang.String style, PDAppearanceContentStream cs, float x, float y, float width, boolean hasStroke, boolean hasBackground, boolean ending) throws java.io.IOException
style
- cs
- x
- y
- width
- hasStroke
- hasBackground
- ending
- false if left, true if right of an imagined horizontal line (important for
arrows).java.io.IOException
void drawArrow(PDAppearanceContentStream cs, float x, float y, float len) throws java.io.IOException
cs
- Content streamx
- y
- len
- The arm length. Positive goes to the right, negative goes to the left.java.io.IOException
- If the content stream could not be writtenvoid drawDiamond(PDAppearanceContentStream cs, float x, float y, float r) throws java.io.IOException
cs
- Content streamx
- y
- r
- Radius (to a corner)java.io.IOException
- If the content stream could not be writtenvoid drawCircle(PDAppearanceContentStream cs, float x, float y, float r) throws java.io.IOException
cs
- Content streamx
- y
- r
- Radiusjava.io.IOException
- If the content stream could not be written.void drawCircle2(PDAppearanceContentStream cs, float x, float y, float r) throws java.io.IOException
cs
- Content streamx
- y
- r
- Radiusjava.io.IOException
- If the content stream could not be written.private static java.util.Set<java.lang.String> createShortStyles()
private static java.util.Set<java.lang.String> createInteriorColorStyles()
private static java.util.Set<java.lang.String> createAngledStyles()
private PDAppearanceEntry getNormalAppearance()
This will get the annotations normal appearance. If this is not existent an empty appearance entry will be created.
private PDAppearanceContentStream getAppearanceEntryAsContentStream(PDAppearanceEntry appearanceEntry, boolean compress) throws java.io.IOException
java.io.IOException
private void setTransformationMatrix(PDAppearanceStream appearanceStream)
PDRectangle handleBorderBox(PDAnnotationSquareCircle annotation, float lineWidth)