Module org.sejda.sambox
Class PDAnnotationLine
java.lang.Object
org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotation
org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationMarkup
org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationLine
- All Implemented Interfaces:
COSObjectable
This is the class that represents a line annotation. Introduced in PDF 1.3 specification
- Author:
- Paul King
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant for annotation intent of Arrow.static final StringConstant for annotation intent of a dimension line.static final StringConstant for a butt line ending.static final StringConstant for a circle line ending.static final StringConstant for a closed arrow line ending.static final StringConstant for a diamond line ending.static final StringConstant for no line ending.static final StringConstant for a open arrow line ending.static final StringConstant for a revered closed arrow line ending.static final StringConstant for a reversed open arrow line ending.static final StringConstant for a slash line ending.static final StringConstant for a square line ending.static final StringThe type of annotation.Fields inherited from class org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationMarkup
IT_FREE_TEXT, IT_FREE_TEXT_CALLOUT, IT_FREE_TEXT_TYPE_WRITER, RT_GROUP, RT_REPLY, SUB_TYPE_CARET, SUB_TYPE_FREETEXT, SUB_TYPE_INK, SUB_TYPE_POLYGON, SUB_TYPE_POLYLINE, SUB_TYPE_SOUNDFields inherited from class org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotation
FLAG_HIDDEN, FLAG_INVISIBLE, FLAG_LOCKED, FLAG_NO_ROTATE, FLAG_NO_VIEW, FLAG_NO_ZOOM, FLAG_PRINTED, FLAG_READ_ONLY, FLAG_TOGGLE_NO_VIEW -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.PDAnnotationLine(COSDictionary field) Creates a Line annotation from a COSDictionary, expected to be a correct object definition. -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate the appearance entry for this annotation.This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the line.booleanThis will retrieve if the contents are shown as a caption or not.floatThis will retrieve the horizontal offset of the caption.This will retrieve the caption positioning.floatThis will retrieve the vertical offset of the caption.This will retrieve the line ending style for the end point, possible values shown in the LE_ constants section.This will retrieve the interior color of the line endings defined in the LE entry.floatThis will retrieve the length of the leader line extensions.floatThis will retrieve the length of the leader line.floatThis will retrieve the length of the leader line offset.float[]getLine()This will retrieve the start and end coordinates of the line (or leader line if LL entry is set).This will retrieve the line ending style for the start point, possible values shown in the LE_ constants section.voidThis will set the border style dictionary, specifying the width and dash pattern used in drawing the line.voidsetCaption(boolean cap) This will set if the contents are shown as a caption to the line.voidsetCaptionHorizontalOffset(float offset) This will set the horizontal offset of the caption.voidsetCaptionPositioning(String captionPositioning) This will set the caption positioning.voidsetCaptionVerticalOffset(float offset) This will set the vertical offset of the caption.voidsetCustomAppearanceHandler(PDAppearanceHandler appearanceHandler) Set a custom appearance handler for generating the annotations appearance streams.voidsetEndPointEndingStyle(String style) This will set the line ending style for the end point, see the LE_ constants for the possible values.voidThis will set interior color of the line endings defined in the LE entry.voidsetLeaderLineExtensionLength(float leaderLineExtensionLength) This will set the length of the leader line extensions.voidsetLeaderLineLength(float leaderLineLength) This will set the length of the leader line.voidsetLeaderLineOffsetLength(float leaderLineOffsetLength) This will set the length of the leader line offset.voidsetLine(float[] l) This will set start and end coordinates of the line (or leader line if LL entry is set).voidsetStartPointEndingStyle(String style) This will set the line ending style for the start point, see the LE_ constants for the possible values.Methods inherited from class org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationMarkup
getBorderEffect, getCallout, getConstantOpacity, getCreationDate, getDefaultAppearance, getDefaultStyleString, getExternalData, getInkList, getInReplyTo, getIntent, getLineEndingStyle, getPath, getPopup, getQ, getRectDifference, getRectDifferences, getReplyType, getRichContents, getSubject, getTitlePopup, getVertices, setBorderEffect, setCallout, setConstantOpacity, setCreationDate, setDefaultAppearance, setDefaultStyleString, setExternalData, setInkList, setInReplyTo, setIntent, setLineEndingStyle, setPopup, setQ, setRectDifference, setRectDifferences, setRectDifferences, setReplyType, setRichContents, setSubject, setTitlePopup, setVerticesMethods inherited from class org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotation
createAnnotation, createAnnotation, getAnnotationFlags, getAnnotationName, getAppearance, getAppearanceState, getBorder, getColor, getColor, getContents, getModifiedDate, getNormalAppearanceStream, getOptionalContent, getPage, getRectangle, getStructParent, getSubtype, isHidden, isInvisible, isLocked, isLockedContents, isNoRotate, isNoView, isNoZoom, isPrinted, isReadOnly, isToggleNoView, setAnnotationFlags, setAnnotationName, setAppearance, setAppearanceState, setBorder, setColor, setContents, setHidden, setInvisible, setLocked, setLockedContents, setModifiedDate, setModifiedDate, setNoRotate, setNoView, setNoZoom, setOptionalContent, setPage, setPrinted, setReadOnly, setRectangle, setStructParent, setToggleNoViewMethods inherited from class org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
equals, getCOSObject, hashCode
-
Field Details
-
IT_LINE_ARROW
Constant for annotation intent of Arrow.- See Also:
-
IT_LINE_DIMENSION
Constant for annotation intent of a dimension line.- See Also:
-
LE_SQUARE
Constant for a square line ending.- See Also:
-
LE_CIRCLE
Constant for a circle line ending.- See Also:
-
LE_DIAMOND
Constant for a diamond line ending.- See Also:
-
LE_OPEN_ARROW
Constant for a open arrow line ending.- See Also:
-
LE_CLOSED_ARROW
Constant for a closed arrow line ending.- See Also:
-
LE_NONE
Constant for no line ending.- See Also:
-
LE_BUTT
Constant for a butt line ending.- See Also:
-
LE_R_OPEN_ARROW
Constant for a reversed open arrow line ending.- See Also:
-
LE_R_CLOSED_ARROW
Constant for a revered closed arrow line ending.- See Also:
-
LE_SLASH
Constant for a slash line ending.- See Also:
-
SUB_TYPE
The type of annotation.- See Also:
-
-
Constructor Details
-
PDAnnotationLine
public PDAnnotationLine()Constructor. -
PDAnnotationLine
Creates a Line annotation from a COSDictionary, expected to be a correct object definition.- Parameters:
field- the PDF object to represent as a field.
-
-
Method Details
-
setLine
public void setLine(float[] l) This will set start and end coordinates of the line (or leader line if LL entry is set).- Parameters:
l- array of 4 floats [x1, y1, x2, y2] line start and end points in default user space.
-
getLine
public float[] getLine()This will retrieve the start and end coordinates of the line (or leader line if LL entry is set).- Returns:
- array of floats [x1, y1, x2, y2] line start and end points in default user space.
-
setStartPointEndingStyle
This will set the line ending style for the start point, see the LE_ constants for the possible values.- Overrides:
setStartPointEndingStylein classPDAnnotationMarkup- Parameters:
style- The new style.
-
getStartPointEndingStyle
This will retrieve the line ending style for the start point, possible values shown in the LE_ constants section.- Overrides:
getStartPointEndingStylein classPDAnnotationMarkup- Returns:
- The ending style for the start point.
-
setEndPointEndingStyle
This will set the line ending style for the end point, see the LE_ constants for the possible values.- Overrides:
setEndPointEndingStylein classPDAnnotationMarkup- Parameters:
style- The new style.
-
getEndPointEndingStyle
This will retrieve the line ending style for the end point, possible values shown in the LE_ constants section.- Overrides:
getEndPointEndingStylein classPDAnnotationMarkup- Returns:
- The ending style for the end point.
-
setInteriorColor
This will set interior color of the line endings defined in the LE entry. color is in DeviceRGB color space.- Overrides:
setInteriorColorin classPDAnnotationMarkup- Parameters:
ic- color in the DeviceRGB color space.
-
getInteriorColor
This will retrieve the interior color of the line endings defined in the LE entry. color is in DeviceRGB color space.- Overrides:
getInteriorColorin classPDAnnotationMarkup- Returns:
- object representing the color.
-
setCaption
public void setCaption(boolean cap) This will set if the contents are shown as a caption to the line.- Parameters:
cap- Boolean value.
-
getCaption
public boolean getCaption()This will retrieve if the contents are shown as a caption or not.- Returns:
- boolean if the content is shown as a caption.
-
setBorderStyle
This will set the border style dictionary, specifying the width and dash pattern used in drawing the line.- Overrides:
setBorderStylein classPDAnnotationMarkup- Parameters:
bs- the border style dictionary to set.
-
getBorderStyle
This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the line.- Overrides:
getBorderStylein classPDAnnotationMarkup- Returns:
- the border style dictionary.
-
getLeaderLineLength
public float getLeaderLineLength()This will retrieve the length of the leader line.- Returns:
- the length of the leader line
-
setLeaderLineLength
public void setLeaderLineLength(float leaderLineLength) This will set the length of the leader line.- Parameters:
leaderLineLength- length of the leader line
-
getLeaderLineExtensionLength
public float getLeaderLineExtensionLength()This will retrieve the length of the leader line extensions.- Returns:
- the length of the leader line extensions
-
setLeaderLineExtensionLength
public void setLeaderLineExtensionLength(float leaderLineExtensionLength) This will set the length of the leader line extensions.- Parameters:
leaderLineExtensionLength- length of the leader line extensions
-
getLeaderLineOffsetLength
public float getLeaderLineOffsetLength()This will retrieve the length of the leader line offset.- Returns:
- the length of the leader line offset
-
setLeaderLineOffsetLength
public void setLeaderLineOffsetLength(float leaderLineOffsetLength) This will set the length of the leader line offset.- Parameters:
leaderLineOffsetLength- length of the leader line offset
-
getCaptionPositioning
This will retrieve the caption positioning.- Returns:
- the caption positioning
-
setCaptionPositioning
This will set the caption positioning. Allowed values are: "Inline" and "Top"- Parameters:
captionPositioning- caption positioning
-
setCaptionHorizontalOffset
public void setCaptionHorizontalOffset(float offset) This will set the horizontal offset of the caption.- Parameters:
offset- the horizontal offset of the caption
-
getCaptionHorizontalOffset
public float getCaptionHorizontalOffset()This will retrieve the horizontal offset of the caption.- Returns:
- the horizontal offset of the caption
-
setCaptionVerticalOffset
public void setCaptionVerticalOffset(float offset) This will set the vertical offset of the caption.- Parameters:
offset- vertical offset of the caption
-
getCaptionVerticalOffset
public float getCaptionVerticalOffset()This will retrieve the vertical offset of the caption.- Returns:
- the vertical offset of the caption
-
setCustomAppearanceHandler
Set a custom appearance handler for generating the annotations appearance streams.- Overrides:
setCustomAppearanceHandlerin classPDAnnotationMarkup- Parameters:
appearanceHandler-
-
constructAppearances
public void constructAppearances()Description copied from class:PDAnnotationCreate the appearance entry for this annotation. Not having it may prevent display in some viewers. This method is for overriding in subclasses, the default implementation does nothing.- Overrides:
constructAppearancesin classPDAnnotationMarkup
-