Skip to content

Commit ef4afc7

Browse files
committed
Updated docs with "Line" and "Stamp" annotations.
1 parent 071ccba commit ef4afc7

8 files changed

+229
-5
lines changed
6.43 KB
Loading
5.73 KB
Loading
3.22 KB
Loading
25.4 KB
Loading
57.5 KB
Loading
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
![Create LineAnnotation](images/pdf-processing-create-lineannotation.png)
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+
![Create LineAnnotation with FixedContentEditor](images/pdf-processing-create-lineannotation-with-fixedcontenteditor.png)
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%})
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Annotations Overview
33
page_title: Annotations Overview
4+
description: Learn what annotation types are supported in the PdfProcessing library offered by the Telerik Document Processing.
45
slug: radpdfprocessing-model-annotations-overview
56
tags: annotations,overview,pdfprocessing
67
published: True
@@ -9,11 +10,23 @@ position: 0
910

1011
# Annotations Overview
1112

12-
The abstract __Annotation__ element associates an object with a location on a [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}). Annotation exposes the following properties:
13+
An *annotation* associates an object such as a note, sound, or movie with a location on a page of a PDF document, or provides a way to interact with the user by
14+
means of the mouse and keyboard. PDF includes a wide variety of standard [annotation types](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Fixed.Model.Annotations.AnnotationType.html). Many of the standard annotation types may be displayed in either the open or the closed state. When closed, they appear on the page in some distinctive form, such as an icon, a box, or a rubber stamp, depending on the specific annotation type. When the user activates the annotation by clicking it, it exhibits its associated object, such as by opening a pop-up window displaying a text note or by playing a sound or a movie.
15+
16+
The abstract **Annotation** element associates an object with a location on a [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}). Annotation exposes the following properties:
1317

14-
* __Rect__: The rectangle, which defines the location of the annotation on the page.
18+
* **Rect**: The rectangle, which defines the location of the annotation on the page.
1519

16-
* __Type__: Property of type [AnnotationType](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Fixed.Model.Annotations.AnnotationType.html), which determines the type of the annotation. The only supported types are [Link]({%slug radpdfprocessing-model-annotations-links%}) and [Widget]({%slug radpdfprocessing-model-annotations-widgets%}).
20+
* **Type**: Property of type [AnnotationType](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Fixed.Model.Annotations.AnnotationType.html), which determines the type of the annotation. The supported types are listed in the following table:
21+
22+
|Annotation Type|Description|
23+
|----|----|
24+
|[Link]({%slug radpdfprocessing-model-annotations-links%})|A link annotation represents either a hypertext link to a destination elsewhere in the document or an action to be performed.|
25+
|[Widget]({%slug radpdfprocessing-model-annotations-widgets%})|Interactive forms use widget annotations to represent the appearance of fields and to manage user interactions.|
26+
|[Text]({%slug radpdfprocessing-model-annotations-text%})|A text annotation represents a *sticky note* attached to a point in the PDF document.|
27+
|[Line]({%slug radpdfprocessing-model-annotations-line%})|Line annotations display a single straight line on the page.|
28+
|[Stamp]({%slug radpdfprocessing-model-annotations-stamp%})|Stamp annotations display text or graphics intended to look as if they were stamped on the page with a rubber stamp.|
29+
|[TextMarkup]({%slug radpdfprocessing-model-annotations-text-markup%})| Text markup annotations appear as **Highlights**, **Underlines**, **Strikeouts** or **Squiggly** underlines in the text of a document. When opened, they display a pop-up window containing the text of the associated note.|
1730
1831
* **Border**: Represents the annotation borders. This property is of type [AnnotationBorder](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Fixed.Model.Annotations.AnnotationBorder.html).
1932

@@ -22,5 +35,6 @@ The abstract __Annotation__ element associates an object with a location on a [R
2235
## See Also
2336

2437
* [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%})
25-
* [AnnotationType API Reference](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Fixed.Model.Annotations.AnnotationType.html)
26-
* [Link API Reference](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Fixed.Model.Annotations.Link.html)
38+
* [TextMarkup]({%slug radpdfprocessing-model-annotations-text-markup%})
39+
* [Text]({%slug radpdfprocessing-model-annotations-text%})
40+
* [Link]({%slug radpdfprocessing-model-annotations-links%})
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: Stamp
3+
page_title: Stamp Annotation
4+
description: Stamp annotations display text or graphics intended to look as if they were stamped on the page with a rubber stamp.
5+
slug: radpdfprocessing-model-annotations-stamp
6+
tags: annotation, overview, pdfprocessing, stamp
7+
published: True
8+
position: 6
9+
---
10+
11+
# Stamp Annotation
12+
13+
A **Stamp annotation** displays text or graphics intended to look as if they were stamped on the page with a rubber stamp. When opened, it displays a pop-up window containing the text of the associated note.
14+
15+
The **StampAnnotation** class is a derivative of the **MarkupAnnotation** (descendent of **ContentAnnotation**) and it exposes the following properties:
16+
17+
|Property|Description|
18+
|---|---|
19+
|**Name**|Gets or sets the name of the stamp. The name can be chosen from the predefined names in the __StampAnnotationPredefinedNames__ class or it can be a custom string. In the case of a custom string an appearance should be provided via the __ContentAnnotation.Content__ property.|
20+
|**Opacity**|Gets or sets the opacity of the annotation.|
21+
|**Contents**|Gets or sets the text that shall be displayed for the annotation.|
22+
|**Color**|Gets or sets the color of the annotation.|
23+
|**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.|
24+
25+
### Creating a StampAnnotation
26+
27+
```csharp
28+
RadFixedDocument document = new RadFixedDocument();
29+
RadFixedPage page = document.Pages.AddPage();
30+
31+
RadFixedPage page = fixedDocument.Pages.AddPage();
32+
33+
StampAnnotation annotation1 = page.Annotations.AddStamp(new Rect(50, 50, 300, 50));
34+
annotation1.Name = StampAnnotationPredefinedNames.SBApproved;
35+
36+
StampAnnotation annotation3 = page.Annotations.AddStamp(new Rect(50, 100, 300, 50));
37+
annotation3.Name = StampAnnotationPredefinedNames.SBCompleted;
38+
39+
StampAnnotation annotation4 = page.Annotations.AddStamp(new Rect(50, 150, 300, 50));
40+
annotation4.Name = StampAnnotationPredefinedNames.SBConfidential;
41+
42+
StampAnnotation annotation5 = page.Annotations.AddStamp(new Rect(50, 200, 300, 50));
43+
annotation5.Name = StampAnnotationPredefinedNames.SBDraft;
44+
45+
StampAnnotation annotation6 = page.Annotations.AddStamp(new Rect(50, 250, 300, 50));
46+
annotation6.Name = StampAnnotationPredefinedNames.SBFinal;
47+
48+
StampAnnotation annotation7 = page.Annotations.AddStamp(new Rect(50, 300, 300, 50));
49+
annotation7.Name = StampAnnotationPredefinedNames.SBForComment;
50+
51+
StampAnnotation annotation8 = page.Annotations.AddStamp(new Rect(50, 350, 300, 50));
52+
annotation8.Name = StampAnnotationPredefinedNames.SBForPublicRelease;
53+
54+
StampAnnotation annotation9 = page.Annotations.AddStamp(new Rect(50, 400, 300, 50));
55+
annotation9.Name = StampAnnotationPredefinedNames.SBInformationOnly;
56+
57+
StampAnnotation annotation10 = page.Annotations.AddStamp(new Rect(50, 450, 300, 50));
58+
annotation10.Name = StampAnnotationPredefinedNames.SBNotApproved;
59+
60+
StampAnnotation annotation11 = page.Annotations.AddStamp(new Rect(50, 500, 300, 50));
61+
annotation11.Name = StampAnnotationPredefinedNames.SBNotForPublicRelease;
62+
63+
StampAnnotation annotation13 = page.Annotations.AddStamp(new Rect(50, 550, 300, 50));
64+
annotation13.Name = StampAnnotationPredefinedNames.SBPreliminaryResults;
65+
66+
StampAnnotation annotation15 = page.Annotations.AddStamp(new Rect(50, 600, 300, 50));
67+
annotation15.Name = StampAnnotationPredefinedNames.SBRejected;
68+
69+
StampAnnotation annotation16 = page.Annotations.AddStamp(new Rect(50, 650, 300, 50));
70+
annotation16.Name = StampAnnotationPredefinedNames.SBVoid;
71+
```
72+
73+
![Create StampAnnotation](images/pdf-processing-create-stampannotation.png)
74+
75+
### Creating a StampAnnotation with FixedContentEditor
76+
77+
The [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) offers the public **DrawStampAnnotation** method which creates a new __StampAnnotation__ and draws it with a specified annotation size and name.
78+
79+
```csharp
80+
RadFixedDocument fixedDocument = new RadFixedDocument();
81+
FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage());
82+
83+
editor.Position.Translate(100, 100);
84+
editor.DrawStampAnnotation(new Size(250, 250), StampAnnotationPredefinedNames.SBFinal);
85+
editor.Position.Translate(400, 100);
86+
editor.DrawStampAnnotation(new Size(250, 250), StampAnnotationPredefinedNames.SBConfidential);
87+
```
88+
89+
![Create StampAnnotation with FixedContentEditor](images/pdf-processing-create-stampannotation-with-fixedcontenteditor.png)
90+
91+
### Creating a StampAnnotation with Appearance
92+
93+
The **AnnotationContentSource** class, accessed by the **Content** property of the annotation object, represents the [FormSource]({%slug radpdfprocessing-model-formsource%}) instances used for displaying the widget content. The following example shows how to create a custom Stamp annotation and change its visual appearance:
94+
95+
>important When creating a custom stamp name (not from the predefined names), it is important to start the name with "#". Otherwise, if the stamp is moved in adobe, its appearance will be rewritten.
96+
97+
>important When creating appearance for an annotation, it is important to create it with the same size as the rect of the annotation otherwise unexpected behavior may occur when the annotation is moved in Adobe.
98+
99+
```csharp
100+
private RadFixedDocument CreateTextAnnotation()
101+
{
102+
RadFixedDocument fixedDocument = new RadFixedDocument();
103+
RadFixedPage page = fixedDocument.Pages.AddPage();
104+
105+
StampAnnotation annotation = page.Annotations.AddStamp(new Rect(100, 100, 300, 100));
106+
annotation.Name = "#Sold";
107+
108+
FormSource simpleForm = new FormSource();
109+
CreateContentFormWithText(simpleForm, "Sold");
110+
111+
AnnotationContentSource content = new AnnotationContentSource();
112+
annotation.Content.NormalContentSource = simpleForm;
113+
return fixedDocument;
114+
}
115+
116+
private static void CreateContentFormWithText(FormSource normalForm, string text)
117+
{
118+
normalForm.Size = new Size(300, 100);
119+
120+
FixedContentEditor formEditor = new FixedContentEditor(normalForm);
121+
122+
using (formEditor.SaveProperties())
123+
{
124+
formEditor.GraphicProperties.IsFilled = true;
125+
formEditor.GraphicProperties.IsStroked = true;
126+
formEditor.GraphicProperties.StrokeThickness = 2;
127+
formEditor.GraphicProperties.StrokeColor = new RgbColor(92, 229, 0);
128+
formEditor.GraphicProperties.FillColor = new RgbColor(213, 222, 226);
129+
formEditor.GraphicProperties.StrokeDashArray = new double[] { 17, 4 };
130+
formEditor.DrawRectangle(new Rect(formEditor.Position.Matrix.OffsetX, formEditor.Position.Matrix.OffsetY, 300,100));
131+
}
132+
133+
formEditor.TextProperties.FontSize = 20;
134+
formEditor.Position.Translate(10, 10);
135+
formEditor.DrawText(text);
136+
}
137+
```
138+
139+
![Create StampAnnotation with Appearance](images/pdf-processing-create-stampannotation-with-appearance.png)
140+
141+
## See Also
142+
143+
* [AcroForm]({%slug radpdfprocessing-model-interactive-forms-acroform %})
144+
* [FormField]({%slug radpdfprocessing-model-interactive-forms-form-fields%})
145+
* [Annotations Overview]({%slug radpdfprocessing-model-annotations-overview%})
146+
* [FormSource]({%slug radpdfprocessing-model-formsource%})

0 commit comments

Comments
 (0)