From cff28ea9c5cb9e7f93398de1de249ed8c595951a Mon Sep 17 00:00:00 2001 From: "PROGRESS\\ykaraman" Date: Wed, 14 May 2025 13:11:57 +0300 Subject: [PATCH 1/2] popup annotation --- .../editing/fixedcontenteditor.md | 1 + .../model/annotations/overview.md | 3 +- .../model/annotations/popup.md | 83 +++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 libraries/radpdfprocessing/model/annotations/popup.md diff --git a/libraries/radpdfprocessing/editing/fixedcontenteditor.md b/libraries/radpdfprocessing/editing/fixedcontenteditor.md index 4930b3f6..a4e3fe0d 100644 --- a/libraries/radpdfprocessing/editing/fixedcontenteditor.md +++ b/libraries/radpdfprocessing/editing/fixedcontenteditor.md @@ -29,6 +29,7 @@ position: 4 |**DrawStampAnnotation**|Creates a new [StampAnnotation]({%slug radpdfprocessing-model-annotations-stamp%}) and draws it with a specified size and name.| |**DrawTextAnnotation**|Creates a new [TextAnnotation]({%slug radpdfprocessing-model-annotations-text%}) and draws it with a specified size and text.| |**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.| +|**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.| |**DrawLine**|Draws a line from point A to point B.| |**DrawRectangle**|Draws a rectangle ([Geometry]({%slug radpdfprocessing-concepts-geometry%})).| |**DrawEllipse**|Draws an ellipse ([Geometry]({%slug radpdfprocessing-concepts-geometry%})).| diff --git a/libraries/radpdfprocessing/model/annotations/overview.md b/libraries/radpdfprocessing/model/annotations/overview.md index 3172ad3e..358e4aef 100644 --- a/libraries/radpdfprocessing/model/annotations/overview.md +++ b/libraries/radpdfprocessing/model/annotations/overview.md @@ -29,7 +29,8 @@ The abstract **Annotation** element associates an object with a location on a [R |[Line]({%slug radpdfprocessing-model-annotations-line%})|Line annotations display a single straight line on the page.| |[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.| |[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.| - +|[Popup]({%slug radpdfprocessing-model-annotations-popup%})|A popup annotation is associated with another [markup annotation]({%slug radpdfprocessing-model-annotations-overview%}) and displays its content in a pop-up window for entry and editing. It typically appears as a pop-up note.| + * **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). * **IsPrintable**: A boolean value that indicates whether the annotation instance should be visualized when printing the document. When set to *false*, the annotation won't appear when the document is printed. diff --git a/libraries/radpdfprocessing/model/annotations/popup.md b/libraries/radpdfprocessing/model/annotations/popup.md new file mode 100644 index 00000000..34c91694 --- /dev/null +++ b/libraries/radpdfprocessing/model/annotations/popup.md @@ -0,0 +1,83 @@ +--- +title: Popup +page_title: Popup Annotation +description: Popup annotations display a pop-up window containing comments or notes associated with the document content. +slug: radpdfprocessing-model-annotations-popup +tags: annotation, overview, pdfprocessing, popup +published: True +position: 7 +--- + +# Popup Annotation + +A **Popup annotation** displays a pop-up window containing text associated with a parent annotation, such as a [Text]({%slug radpdfprocessing-model-annotations-text%}), [Line]({%slug radpdfprocessing-model-annotations-line%}), [TextMarkup]({%slug radpdfprocessing-model-annotations-text-markup%}) or [Stamp]({%slug radpdfprocessing-model-annotations-stamp%}) annotation. When closed, a popup annotation is invisible. When open, it should appear as a pop-up window at a specified location on the page. + +The **PopupAnnotation** class is a derivative of the **Annotation** class and it exposes the following properties: + +|Property|Description| +|---|---| +|**ParentAnnotation**|Gets or sets the parent [MarkupAnnotation]({%slug radpdfprocessing-model-annotations-overview%}) that this popup is associated with.| +|**IsOpen**|Gets or sets a value indicating whether the popup is initially open.| + +## Creating a PopupAnnotation + +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: + +```csharp + RadFixedDocument document = new RadFixedDocument(); + RadFixedPage page = document.Pages.AddPage(); + + TextAnnotation annotation = page.Annotations.AddText(new Rect(100, 100, 200, 200)); + annotation.Contents = "Test text"; + + PopupAnnotation popupAnnot = page.Annotations.AddPopup(annotation); + popupAnnot.IsOpen = true; +``` +The popup annotation will display the contents of the text annotation in a pop-up window. + +## Creating a PopupAnnotation with FixedContentEditor + +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: + +```csharp + RadFixedDocument fixedDocument = new RadFixedDocument(); + RadFixedPage page = fixedDocument.Pages.AddPage(); + FixedContentEditor editor = new FixedContentEditor(page); + + // Create a parent annotation first + TextAnnotation textAnnotation = page.Annotations.AddText(new Rect(100, 100, 50, 50)); + textAnnotation.Contents = "Parent annotation text"; + + // Create an associated popup annotation + editor.Position.Translate(100, 100); + editor.DrawPopupAnnotation(new Size(200, 100), textAnnotation); +``` + +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**: + +```csharp + RadFixedDocument fixedDocument = new RadFixedDocument(); + FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage()); + + editor.Position.Translate(100, 100); + Size annotationSize = new Size(50, 50); + Size popupSize = new Size(250, 100); + string text = "This is a TextAnnotation"; + bool addPopup = true; + + editor.DrawTextAnnotation(annotationSize, popupSize, text, addPopup); + + // Access the created popup annotation if needed + PopupAnnotation popupAnnotation = fixedDocument.Pages[0].Annotations[1] as PopupAnnotation; +``` + +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. + +## See Also + +* [Annotations Overview]({%slug radpdfprocessing-model-annotations-overview%}) +* [Text Annotation]({%slug radpdfprocessing-model-annotations-text%}) +* [Line Annotation]({%slug radpdfprocessing-model-annotations-line%}) +* [TextMarkup Annotation]({%slug radpdfprocessing-model-annotations-text-markup%}) +* [Stamp Annotation]({%slug radpdfprocessing-model-annotations-stamp%}) +* [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) From c7002a97fa3008b21c9ee7be40f009ae7af5eed4 Mon Sep 17 00:00:00 2001 From: "PROGRESS\\ykaraman" Date: Wed, 14 May 2025 13:57:07 +0300 Subject: [PATCH 2/2] Extracted code snippets in solution. --- .../editing/fixedcontenteditor.md | 1 - .../model/annotations/popup.md | 42 +------------------ 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/libraries/radpdfprocessing/editing/fixedcontenteditor.md b/libraries/radpdfprocessing/editing/fixedcontenteditor.md index a4e3fe0d..4930b3f6 100644 --- a/libraries/radpdfprocessing/editing/fixedcontenteditor.md +++ b/libraries/radpdfprocessing/editing/fixedcontenteditor.md @@ -29,7 +29,6 @@ position: 4 |**DrawStampAnnotation**|Creates a new [StampAnnotation]({%slug radpdfprocessing-model-annotations-stamp%}) and draws it with a specified size and name.| |**DrawTextAnnotation**|Creates a new [TextAnnotation]({%slug radpdfprocessing-model-annotations-text%}) and draws it with a specified size and text.| |**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.| -|**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.| |**DrawLine**|Draws a line from point A to point B.| |**DrawRectangle**|Draws a rectangle ([Geometry]({%slug radpdfprocessing-concepts-geometry%})).| |**DrawEllipse**|Draws an ellipse ([Geometry]({%slug radpdfprocessing-concepts-geometry%})).| diff --git a/libraries/radpdfprocessing/model/annotations/popup.md b/libraries/radpdfprocessing/model/annotations/popup.md index 34c91694..bbda6523 100644 --- a/libraries/radpdfprocessing/model/annotations/popup.md +++ b/libraries/radpdfprocessing/model/annotations/popup.md @@ -23,53 +23,15 @@ The **PopupAnnotation** class is a derivative of the **Annotation** class and it 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: -```csharp - RadFixedDocument document = new RadFixedDocument(); - RadFixedPage page = document.Pages.AddPage(); + - TextAnnotation annotation = page.Annotations.AddText(new Rect(100, 100, 200, 200)); - annotation.Contents = "Test text"; - - PopupAnnotation popupAnnot = page.Annotations.AddPopup(annotation); - popupAnnot.IsOpen = true; -``` The popup annotation will display the contents of the text annotation in a pop-up window. ## Creating a PopupAnnotation with FixedContentEditor -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: - -```csharp - RadFixedDocument fixedDocument = new RadFixedDocument(); - RadFixedPage page = fixedDocument.Pages.AddPage(); - FixedContentEditor editor = new FixedContentEditor(page); - - // Create a parent annotation first - TextAnnotation textAnnotation = page.Annotations.AddText(new Rect(100, 100, 50, 50)); - textAnnotation.Contents = "Parent annotation text"; - - // Create an associated popup annotation - editor.Position.Translate(100, 100); - editor.DrawPopupAnnotation(new Size(200, 100), textAnnotation); -``` - 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**: -```csharp - RadFixedDocument fixedDocument = new RadFixedDocument(); - FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage()); - - editor.Position.Translate(100, 100); - Size annotationSize = new Size(50, 50); - Size popupSize = new Size(250, 100); - string text = "This is a TextAnnotation"; - bool addPopup = true; - - editor.DrawTextAnnotation(annotationSize, popupSize, text, addPopup); - - // Access the created popup annotation if needed - PopupAnnotation popupAnnotation = fixedDocument.Pages[0].Annotations[1] as PopupAnnotation; -``` + 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.