Skip to content

Commit c7002a9

Browse files
committed
Extracted code snippets in solution.
1 parent 170df94 commit c7002a9

File tree

2 files changed

+2
-41
lines changed

2 files changed

+2
-41
lines changed

libraries/radpdfprocessing/editing/fixedcontenteditor.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ position: 4
2929
|**DrawStampAnnotation**|Creates a new [StampAnnotation]({%slug radpdfprocessing-model-annotations-stamp%}) and draws it with a specified size and name.|
3030
|**DrawTextAnnotation**|Creates a new [TextAnnotation]({%slug radpdfprocessing-model-annotations-text%}) and draws it with a specified size and text.|
3131
|**DrawLineAnnotation**|Creates a new [LineAnnotation]({%slug radpdfprocessing-model-annotations-line%}) with starting point the current point of the editor and end point the current point of the editor plus the given distances.|
32-
|**DrawPopupAnnotation**|Creates a new [PopupAnnotation]({%slug radpdfprocessing-model-annotations-popup%}), associates it with a [markup annotation]({%slug radpdfprocessing-model-annotations-overview%}), and draws it with the specified size and properties.|
3332
|**DrawLine**|Draws a line from point A to point B.|
3433
|**DrawRectangle**|Draws a rectangle ([Geometry]({%slug radpdfprocessing-concepts-geometry%})).|
3534
|**DrawEllipse**|Draws an ellipse ([Geometry]({%slug radpdfprocessing-concepts-geometry%})).|

libraries/radpdfprocessing/model/annotations/popup.md

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,15 @@ The **PopupAnnotation** class is a derivative of the **Annotation** class and it
2323

2424
Popup annotations are typically created in association with another markup annotation, such as Text, Line, TextMarkup or Stamp. The following example shows how to create a PopupAnnotation associated with a TextAnnotation:
2525

26-
```csharp
27-
RadFixedDocument document = new RadFixedDocument();
28-
RadFixedPage page = document.Pages.AddPage();
26+
<snippet id='libraries-pdf-model-annotations-popup-create'/>
2927

30-
TextAnnotation annotation = page.Annotations.AddText(new Rect(100, 100, 200, 200));
31-
annotation.Contents = "Test text";
32-
33-
PopupAnnotation popupAnnot = page.Annotations.AddPopup(annotation);
34-
popupAnnot.IsOpen = true;
35-
```
3628
The popup annotation will display the contents of the text annotation in a pop-up window.
3729

3830
## Creating a PopupAnnotation with FixedContentEditor
3931

40-
You can create a popup annotation by using the FixedContentEditor's **DrawPopupAnnotation** method. The constructor expects two parameters - the size of the popup and the markup annotation to be associated with the popup:
41-
42-
```csharp
43-
RadFixedDocument fixedDocument = new RadFixedDocument();
44-
RadFixedPage page = fixedDocument.Pages.AddPage();
45-
FixedContentEditor editor = new FixedContentEditor(page);
46-
47-
// Create a parent annotation first
48-
TextAnnotation textAnnotation = page.Annotations.AddText(new Rect(100, 100, 50, 50));
49-
textAnnotation.Contents = "Parent annotation text";
50-
51-
// Create an associated popup annotation
52-
editor.Position.Translate(100, 100);
53-
editor.DrawPopupAnnotation(new Size(200, 100), textAnnotation);
54-
```
55-
5632
When creating a TextAnnotation with the [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%})'s **DrawTextAnnotation** method, you can also associate a popup annotation by setting the `addPopup` parameter to **true**:
5733

58-
```csharp
59-
RadFixedDocument fixedDocument = new RadFixedDocument();
60-
FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage());
61-
62-
editor.Position.Translate(100, 100);
63-
Size annotationSize = new Size(50, 50);
64-
Size popupSize = new Size(250, 100);
65-
string text = "This is a TextAnnotation";
66-
bool addPopup = true;
67-
68-
editor.DrawTextAnnotation(annotationSize, popupSize, text, addPopup);
69-
70-
// Access the created popup annotation if needed
71-
PopupAnnotation popupAnnotation = fixedDocument.Pages[0].Annotations[1] as PopupAnnotation;
72-
```
34+
<snippet id='libraries-pdf-model-annotations-popup-create-with-fixedcontenteditor'/>
7335

7436
This code creates a [TextAnnotation]({%slug radpdfprocessing-model-annotations-text%}) with an associated **PopupAnnotation**. The popup will display the text provided in the method call.
7537

0 commit comments

Comments
 (0)