org.apache.pdfbox.pdmodel.interactive.annotation

## Class PDAnnotationLine

- java.lang.Object
- - org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation
  - - org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
    - - org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLine

All Implemented Interfaces:
  COSObjectable

    public class PDAnnotationLine
    extends PDAnnotationMarkup

This is the class that represents a line annotation. Introduced in PDF 1.3 specification

Author:
  Paul King

### Field Summary

Fields
`static String` `IT_LINE_ARROW` Constant for annotation intent of Arrow.
`static String` `IT_LINE_DIMENSION` Constant for annotation intent of a dimension line.
`static String` `LE_BUTT` Constant for a butt line ending.
`static String` `LE_CIRCLE` Constant for a circle line ending.
`static String` `LE_CLOSED_ARROW` Constant for a closed arrow line ending.
`static String` `LE_DIAMOND` Constant for a diamond line ending.
`static String` `LE_NONE` Constant for no line ending.
`static String` `LE_OPEN_ARROW` Constant for a open arrow line ending.
`static String` `LE_R_CLOSED_ARROW` Constant for a reversed closed arrow line ending.
`static String` `LE_R_OPEN_ARROW` Constant for a reversed open arrow line ending.
`static String` `LE_SLASH` Constant for a slash line ending.
`static String` `LE_SQUARE` Constant for a square line ending.
`static String` `SUB_TYPE` The type of annotation.

### Fields inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup

`RT_GROUP, RT_REPLY`

### Constructor Summary

Constructors
Constructor and Description
`PDAnnotationLine()` Constructor.
`PDAnnotationLine(COSDictionary field)` Creates a Line annotation from a COSDictionary, expected to be a correct object definition.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `constructAppearances()` Create the appearance entry for this annotation.
`void` `constructAppearances(PDDocument document)` Create the appearance entry for this annotation.
`float` `getCaptionHorizontalOffset()` This will retrieve the horizontal offset of the caption.
`String` `getCaptionPositioning()` This will retrieve the caption positioning.
`float` `getCaptionVerticalOffset()` This will retrieve the vertical offset of the caption.
`String` `getEndPointEndingStyle()` This will retrieve the line ending style for the end point, possible values shown in the LE_ constants section.
`PDColor` `getInteriorColor()` This will retrieve the interior color of the line endings defined in the LE entry.
`float` `getLeaderLineExtensionLength()` This will retrieve the length of the leader line extensions.
`float` `getLeaderLineLength()` This will retrieve the length of the leader line.
`float` `getLeaderLineOffsetLength()` This 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).
`String` `getStartPointEndingStyle()` This will retrieve the line ending style for the start point, possible values shown in the LE_ constants section.
`boolean` `hasCaption()` This will retrieve whether the text specified by the /Contents or /RC entries shall be shown as a caption in the appearance of the line.
`void` `setCaption(boolean cap)` This will set if the contents are shown as a caption to the line.
`void` `setCaptionHorizontalOffset(float offset)` This will set the horizontal offset of the caption.
`void` `setCaptionPositioning(String captionPositioning)` This will set the caption positioning.
`void` `setCaptionVerticalOffset(float offset)` This will set the vertical offset of the caption.
`void` `setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)` Set a custom appearance handler for generating the annotations appearance streams.
`void` `setEndPointEndingStyle(String style)` This will set the line ending style for the end point, see the LE_ constants for the possible values.
`void` `setInteriorColor(PDColor ic)` This will set interior color of the line endings defined in the LE entry.
`void` `setLeaderLineExtensionLength(float leaderLineExtensionLength)` This will set the length of the leader line extensions.
`void` `setLeaderLineLength(float leaderLineLength)` This will set the length of the leader line.
`void` `setLeaderLineOffsetLength(float leaderLineOffsetLength)` This will set the length of the leader line offset.
`void` `setLine(float[] l)` This will set start and end coordinates of the line (or leader line if LL entry is set).
`void` `setStartPointEndingStyle(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.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup

`getBorderStyle, getConstantOpacity, getCreationDate, getExternalData, getInReplyTo, getIntent, getPopup, getReplyType, getRichContents, getSubject, getTitlePopup, setBorderStyle, setConstantOpacity, setCreationDate, setExternalData, setInReplyTo, setIntent, setPopup, setReplyType, setRichContents, setSubject, setTitlePopup`

### Methods inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation

`createAnnotation, equals, getAnnotationFlags, getAnnotationName, getAppearance, getAppearanceState, getBorder, getColor, getColor, getContents, getCOSObject, getModifiedDate, getNormalAppearanceStream, getOptionalContent, getPage, getRectangle, getStructParent, getSubtype, hashCode, 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, setSubtype, setToggleNoView`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### IT_LINE_ARROW

    public static final String IT_LINE_ARROW

Constant for annotation intent of Arrow.

See Also:
  Constant Field Values

#### IT_LINE_DIMENSION

    public static final String IT_LINE_DIMENSION

Constant for annotation intent of a dimension line.

See Also:
  Constant Field Values

#### LE_SQUARE

    public static final String LE_SQUARE

Constant for a square line ending.

See Also:
  Constant Field Values

#### LE_CIRCLE

    public static final String LE_CIRCLE

Constant for a circle line ending.

See Also:
  Constant Field Values

#### LE_DIAMOND

    public static final String LE_DIAMOND

Constant for a diamond line ending.

See Also:
  Constant Field Values

#### LE_OPEN_ARROW

    public static final String LE_OPEN_ARROW

Constant for a open arrow line ending.

See Also:
  Constant Field Values

#### LE_CLOSED_ARROW

    public static final String LE_CLOSED_ARROW

Constant for a closed arrow line ending.

See Also:
  Constant Field Values

#### LE_NONE

    public static final String LE_NONE

Constant for no line ending.

See Also:
  Constant Field Values

#### LE_BUTT

    public static final String LE_BUTT

Constant for a butt line ending.

See Also:
  Constant Field Values

#### LE_R_OPEN_ARROW

    public static final String LE_R_OPEN_ARROW

Constant for a reversed open arrow line ending.

See Also:
  Constant Field Values

#### LE_R_CLOSED_ARROW

    public static final String LE_R_CLOSED_ARROW

Constant for a reversed closed arrow line ending.

See Also:
  Constant Field Values

#### LE_SLASH

    public static final String LE_SLASH

Constant for a slash line ending.

See Also:
  Constant Field Values

#### SUB_TYPE

    public static final String SUB_TYPE

The type of annotation.

See Also:
  Constant Field Values

### Constructor Detail

#### PDAnnotationLine

    public PDAnnotationLine()

Constructor.

#### PDAnnotationLine

    public PDAnnotationLine(COSDictionary field)

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 Detail

#### 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

    public void setStartPointEndingStyle(String style)

This will set the line ending style for the start point, see the LE_ constants for the possible values.

Parameters:
  `style` - The new style.

#### getStartPointEndingStyle

    public String getStartPointEndingStyle()

This will retrieve the line ending style for the start point, possible values shown in the LE_ constants section.

Returns:
  The ending style for the start point, LE_NONE if missing, never null.

#### setEndPointEndingStyle

    public void setEndPointEndingStyle(String style)

This will set the line ending style for the end point, see the LE_ constants for the possible values.

Parameters:
  `style` - The new style.

#### getEndPointEndingStyle

    public String getEndPointEndingStyle()

This will retrieve the line ending style for the end point, possible values shown in the LE_ constants section.

Returns:
  The ending style for the end point, LE_NONE if missing, never null.

#### setInteriorColor

    public void setInteriorColor(PDColor ic)

This will set interior color of the line endings defined in the LE entry. color is in DeviceRGB color space.

Parameters:
  `ic` - color in the DeviceRGB color space.

#### getInteriorColor

    public PDColor getInteriorColor()

This will retrieve the interior color of the line endings defined in the LE entry. color is in DeviceRGB color space.

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.

#### hasCaption

    public boolean hasCaption()

This will retrieve whether the text specified by the /Contents or /RC entries shall be shown as a caption in the appearance of the line.

Returns:
  boolean if the contents shall be shown as a caption (default: false).

#### 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

    public String getCaptionPositioning()

This will retrieve the caption positioning.

Returns:
  the caption positioning

#### setCaptionPositioning

    public void setCaptionPositioning(String captionPositioning)

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

    public void setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)

Set a custom appearance handler for generating the annotations appearance streams.

Parameters:
  `appearanceHandler` - custom appearance handler

#### constructAppearances

    public void constructAppearances()

Description copied from class: `PDAnnotation`
Create 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:
  `constructAppearances` in class `PDAnnotation`

#### constructAppearances

    public void constructAppearances(PDDocument document)

Description copied from class: `PDAnnotation`
Create 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:
  `constructAppearances` in class `PDAnnotation`
Parameters:
  `document` - the related document