Skip to main content

LineAnnotation Class

Defines a line annotation.

Declaration

public class LineAnnotation extends UnclosedPathAnnotation

Remarks

The following code snippet draws a line annotation:

 Line Annotation, DevExpress PDF Document API for Java

package pdf;

import com.devexpress.docs.*;
import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;

import java.nio.channels.*;
import java.nio.file.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (FileChannel fileChannel = FileChannel.open(Path.of("Document.pdf"));
             PdfDocument pdfDocument = new PdfDocument(fileChannel)) {

            Page page = pdfDocument.getPages().getFirst();

            createLineAnnotation(page);

            try (WritableByteChannel channel =
                         FileChannel.open(Path.of("Result.pdf"),
                                 StandardOpenOption.CREATE,
                                 StandardOpenOption.WRITE,
                                 StandardOpenOption.TRUNCATE_EXISTING)) {

                pdfDocument.save(channel);
            }
        }
    }

    static void createLineAnnotation(Page page) {
        LineAnnotation annotation =
                new LineAnnotation(
                        new PointF(10, 340),
                        new PointF(80, 400));

        annotation.setTitle("Reviewer");
        annotation.setSubject("Content Review");
        annotation.setContent("Update this paragraph.");
        annotation.setColor(PdfColor.getRed());
        annotation.setOpacity(0.6);
        annotation.setStartLineEnding(AnnotationLineEndingStyle.BUTT);
        annotation.setFinishLineEnding(AnnotationLineEndingStyle.OPEN_ARROW);

        page.getAnnotations().add(annotation);
    }
}

Refer to the following help topic for additional information: Drawing Annotations.

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

LineAnnotation(PointF startPoint, PointF endPoint)

Initializes a new instance of the LineAnnotation class with the specified start and end points.

Declaration

public LineAnnotation(PointF startPoint, PointF endPoint)

Parameters

Name Type Description
startPoint com.devexpress.system.drawing.PointF

The line annotation start point.

endPoint com.devexpress.system.drawing.PointF

The line annotation end point.

Methods

getCaptionPosition() Method

Returns the line annotation caption position.

Declaration

public LineAnnotationCaptionPosition getCaptionPosition()

Returns

Type Description
LineAnnotationCaptionPosition

The line annotation caption position.

getEndPoint() Method

Returns the line annotation end point.

Declaration

public PointF getEndPoint()

Returns

Type Description
com.devexpress.system.drawing.PointF

The line annotation end point.

getHorizontalCaptionOffset() Method

Returns the horizontal caption offset.

Declaration

public double getHorizontalCaptionOffset()

Returns

Type Description
double

The horizontal caption offset.

getLeaderLineExtensionsLength() Method

Returns the leader line extension length.

Declaration

public double getLeaderLineExtensionsLength()

Returns

Type Description
double

The leader line extension length.

getLeaderLineOffset() Method

Returns the leader line offset.

Declaration

public double getLeaderLineOffset()

Returns

Type Description
double

The leader line offset.

getLeaderLinesLength() Method

Returns the leader line length.

Declaration

public double getLeaderLinesLength()

Returns

Type Description
double

The leader line length.

getLineIntent() Method

Returns the line annotation intent.

Declaration

public LineAnnotationIntent getLineIntent()

Returns

Type Description
LineAnnotationIntent

The line annotation intent.

getShowCaption() Method

Returns whether the line annotation caption is displayed.

Declaration

public boolean getShowCaption()

Returns

Type Description
boolean

true if the line annotation caption is displayed; otherwise, false.

getStartPoint() Method

Returns the line annotation start point.

Declaration

public PointF getStartPoint()

Returns

Type Description
com.devexpress.system.drawing.PointF

The line annotation start point.

getVerticalCaptionOffset() Method

Returns the vertical caption offset.

Declaration

public double getVerticalCaptionOffset()

Returns

Type Description
double

The vertical caption offset.

setCaptionPosition(LineAnnotationCaptionPosition value) Method

Sets the line annotation caption position.

Declaration

public void setCaptionPosition(LineAnnotationCaptionPosition value)

Parameters

Name Type Description
value LineAnnotationCaptionPosition

The line annotation caption position.

setEndPoint(PointF value) Method

Sets the line annotation end point.

Declaration

public void setEndPoint(PointF value)

Parameters

Name Type Description
value com.devexpress.system.drawing.PointF

The line annotation end point.

setHorizontalCaptionOffset(double value) Method

Sets the horizontal caption offset.

Declaration

public void setHorizontalCaptionOffset(double value)

Parameters

Name Type Description
value double

The horizontal caption offset.

setLeaderLineExtensionsLength(double value) Method

Sets the leader line extension length.

Declaration

public void setLeaderLineExtensionsLength(double value)

Parameters

Name Type Description
value double

The leader line extension length.

setLeaderLineOffset(double value) Method

Sets the leader line offset.

Declaration

public void setLeaderLineOffset(double value)

Parameters

Name Type Description
value double

The leader line offset.

setLeaderLinesLength(double value) Method

Sets the leader line length.

Declaration

public void setLeaderLinesLength(double value)

Parameters

Name Type Description
value double

The leader line length.

setLineIntent(LineAnnotationIntent value) Method

Sets the line annotation intent.

Declaration

public void setLineIntent(LineAnnotationIntent value)

Parameters

Name Type Description
value LineAnnotationIntent

The line annotation intent.

setShowCaption(boolean value) Method

Sets whether to display the line annotation caption.

Declaration

public void setShowCaption(boolean value)

Parameters

Name Type Description
value boolean

true to display the line annotation caption; otherwise, false.

setStartPoint(PointF value) Method

Sets the line annotation start point.

Declaration

public void setStartPoint(PointF value)

Parameters

Name Type Description
value com.devexpress.system.drawing.PointF

The line annotation start point.

setVerticalCaptionOffset(double value) Method

Sets the vertical caption offset.

Declaration

public void setVerticalCaptionOffset(double value)

Parameters

Name Type Description
value double

The vertical caption offset.