|
| 1 | +--- |
| 2 | +title: Line |
| 3 | +page_title: Line Annotation |
| 4 | +description: Line annotations display a single straight line on the page. |
| 5 | +slug: radpdfprocessing-model-annotations-line |
| 6 | +tags: annotation, overview, pdfprocessing, line |
| 7 | +published: True |
| 8 | +position: 5 |
| 9 | +--- |
| 10 | + |
| 11 | +# Line Annotation |
| 12 | + |
| 13 | +A **Line annotation** displays a single straight line on the page. When opened, it displays a pop-up window containing the text of the associated note. |
| 14 | + |
| 15 | +The **LineAnnotation** class is a derivative of the **MarkupAnnotation** (descendent of **ContentAnnotation**) and it exposes the following properties: |
| 16 | + |
| 17 | +|Property|Description| |
| 18 | +|---|---| |
| 19 | +|**Start**|Gets or sets the starting point of the annotation.| |
| 20 | +|**End**|Gets or sets the ending point of the annotation.| |
| 21 | +|**StartLineEndingType**|Gets or sets the line ending type for the start of the line.| |
| 22 | +|**EndLineEndingType**|Gets or sets the line ending type for the end of the line.| |
| 23 | +|**Opacity**|Gets or sets the opacity of the annotation.| |
| 24 | +|**Contents**|Gets or sets the text that shall be displayed for the annotation.| |
| 25 | +|**Color**|Gets or sets the color of the annotation.| |
| 26 | +|**Content**|Gets the source defining the visual content of the annotation. This content is with bigger priority compared to the annotation appearance characteristics and text properties and it is visualized by default when opening the exported document in some PDF viewer.| |
| 27 | + |
| 28 | +### Creating a LineAnnotation |
| 29 | + |
| 30 | +```csharp |
| 31 | + RadFixedDocument document = new RadFixedDocument(); |
| 32 | + RadFixedPage page = document.Pages.AddPage(); |
| 33 | + |
| 34 | + LineAnnotation annotation = page.Annotations.AddLine(new Point(10, 10), new Point(300, 300)); |
| 35 | + annotation.StartLineEndingType = LineEndingType.None; |
| 36 | + annotation.EndLineEndingType = LineEndingType.OpenArrow; |
| 37 | + annotation.Color = new RgbColor(255, 0, 0); //Default RgbColor(255, 255, 255) |
| 38 | + annotation.Contents = "This is a LineAnnotation"; |
| 39 | + annotation.Opacity = 0.5; |
| 40 | + annotation.RecalculateContent(); |
| 41 | +``` |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +### Creating a LineAnnotation with FixedContentEditor |
| 46 | + |
| 47 | +The [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) offers the public **DrawLineAnnotation** method which creates a new __LineAnnotation__ with starting point the current point of the editor and end point the current point of the editor plus the given distances. |
| 48 | + |
| 49 | +```csharp |
| 50 | + RadFixedDocument fixedDocument = new RadFixedDocument(); |
| 51 | + FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage()); |
| 52 | + |
| 53 | + editor.Position.Translate(50, 50); |
| 54 | + editor.DrawText("Line starts here."); |
| 55 | + editor.DrawLineAnnotation(300, 400); |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +## See Also |
| 61 | + |
| 62 | +* [AcroForm]({%slug radpdfprocessing-model-interactive-forms-acroform %}) |
| 63 | +* [FormField]({%slug radpdfprocessing-model-interactive-forms-form-fields%}) |
| 64 | +* [Annotations Overview]({%slug radpdfprocessing-model-annotations-overview%}) |
0 commit comments