Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ keywords: .net maui pdf viewer, .net maui view pdf, pdf viewer in .net maui, .ne

# Add, Remove, and Edit Annotations

This section will review the various functions in the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) for adding, removing, and editing annotations in a PDF document.
This section explains the various functions in the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) for adding, removing, and editing annotations in a PDF document.

## Add annotations to a PDF document

This section will go through how to add annotations to a PDF document programmatically.
This section explains how to add annotations to a PDF document programmatically.

### Add annotations programmatically

You can add a new annotation to the PDF document programmatically by creating an annotation instance and providing it as a parameter to the [AddAnnotation](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_AddAnnotation_Syncfusion_Maui_PdfViewer_Annotation_) method. The following example shows how to create an instance of a circle annotation and add it to the PDF document. Similarly, you can create and add other types of annotations.
You can add a new annotation to the PDF document programmatically by creating an annotation instance and providing it as a parameter to the [AddAnnotation](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_AddAnnotation_Syncfusion_Maui_PdfViewer_Annotation_) method. The following example shows how to create an instance of a circle annotation and add it to the PDF document. Similarly, you can create and add other types of annotations. For more information on the available annotation types, refer to the [Annotations Overview](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/annotations-overview).

{% tabs %}
{% highlight c# %}
Expand Down Expand Up @@ -65,7 +65,7 @@ private void OnAnnotationAdded(object sender, AnnotationEventArgs e)

## Remove annotations from the PDF document

This section will go through different methods of removing annotations from a PDF document.
This section explains different methods of removing annotations from a PDF document.

### Remove a specific annotation

Expand Down Expand Up @@ -174,11 +174,11 @@ private void OnAnnotationEdited(object sender, AnnotationEventArgs e)
{% endhighlight %}
{% endtabs %}

### Adding custom information to an annotation
## Adding custom information to an annotation

The [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) allows you to assign custom information to annotations. The [CustomData](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.Annotation.html#Syncfusion_Maui_PdfViewer_Annotation_CustomData) property is utilized to store additional information about each annotation instance for reference. However, it's essential to note that these data are solely intended for reference purposes and will not be displayed in the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) interface.
The [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) allows you to assign custom information to annotations. The [CustomData](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.Annotation.html#Syncfusion_Maui_PdfViewer_Annotation_CustomData) property is utilized to store additional information about each annotation instance for reference. However, it's essential to note that this data is solely intended for reference purposes and will not be displayed in the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) interface.

The provided code sample illustrates how to set the [CustomData](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.Annotation.html#Syncfusion_Maui_PdfViewer_Annotation_CustomData) property for an annotation. Within this code sample, we set the custom data to represent the creation date of the annotation.
The provided code sample illustrates how to set the [CustomData](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.Annotation.html#Syncfusion_Maui_PdfViewer_Annotation_CustomData) property for an annotation. In this code sample, the custom data is set to represent the creation date of the annotation.

{% tabs %}
{% highlight C# %}
Expand All @@ -196,3 +196,9 @@ private void OnAnnotationAdded(object sender, AnnotationEventArgs e)
- [Select and Deselect Annotations](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/select-deselect-annotations)
- [Import and Export Annotations](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/import-export-annotations)
- [Undo and Redo](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/undo-redo)
- [Shapes](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/shapes)
- [Text Markups](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/text-markups)
- [Ink](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/ink)
- [Signature](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/signature)
- [Stamps](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/stamps)
- [Save a Document](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/save-a-document)
17 changes: 10 additions & 7 deletions Document-Processing/PDF/PDF-Viewer/maui/Annotation-Collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ keywords: .net maui pdf viewer, .net maui view pdf, pdf viewer in .net maui, .ne

# Annotation Collection in .NET MAUI PDF Viewer (SfPdfViewer)

The existing annotations in a PDF document can be accessed using the [Annotations](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_Annotations) property of the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html). This read only property will have the annotation collection information as soon as the document is loaded into the PDF Viewer. The following example explains how to use the property to obtain information about a square annotation that is the first on a specific document.
The existing annotations in a PDF document can be accessed using the [Annotations](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_Annotations) property of the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html). This read-only property will have the annotation collection information as soon as the document is loaded into the PDF Viewer.
The following example explains how to use the property to obtain information about the first annotation in a specific document.

{% tabs %}
{% highlight c# %}
Expand Down Expand Up @@ -42,7 +43,7 @@ private void OnDocumentLoaded(object sender, EventArgs e)
{% endtabs %}

## AnnotationsLoaded event
The [AnnotationsLoaded](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_AnnotationsLoaded) event occurs after all annotations in the PDF have finished loading, either when the document is opened or when annotations are imported. You can use this event to perform actions once annotations are fully available in the viewer.
The [AnnotationsLoaded](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_AnnotationsLoaded) event occurs after all annotations in the PDF have finished loading, either when the document is opened or when annotations are imported. The `AnnotationsLoaded` event fires after the [DocumentLoaded](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_DocumentLoaded) event, once all annotations are fully available in the viewer. You can use this event to perform actions once annotations are fully available in the viewer.
The following example explains how to wire and handle the event.

{% tabs %}
Expand All @@ -51,10 +52,10 @@ The following example explains how to wire and handle the event.
void WireAnnotationsLoadedEvent()
{
// Wire the annotations loaded event of [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html).
pdfViewer.AnnotationsLoaded += OnAnnotationsLoaded;
PdfViewer.AnnotationsLoaded += OnAnnotationsLoaded;
}

private void OnAnnotationsLoaded(object? sender, EventArgs e)
private void OnAnnotationsLoaded(object sender, EventArgs e)
{
Debug.WriteLine("All annotations have been loaded.");
}
Expand All @@ -63,6 +64,8 @@ private void OnAnnotationsLoaded(object? sender, EventArgs e)
{% endtabs %}

## See Also
- [Add, Remove, and Modify Annotations](../add-remove-modify-annotations)
- [Annotations Overview](../annotations-overview)
- [Select and Deselect Annotations](../select-deselect-annotations)
- [Add, Remove, and Edit Annotations](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/add-remove-modify-annotations)
- [Annotations Overview](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/annotations-overview)
- [Select and Deselect Annotations](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/select-deselect-annotations)
- [Import and Export Annotations](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/import-export-annotations)
- [Undo and Redo](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/undo-redo)
48 changes: 28 additions & 20 deletions Document-Processing/PDF/PDF-Viewer/maui/Annotations-Comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The PDF Viewer control provides options to add, edit, and delete comments for th
6. Free text annotation
7. Signature annotation

## Showing/Hiding the Comment panel
## Showing or hiding the comment panel
The built-in Comment Panel in the PDF Viewer displays annotation comments. You can show or hide this panel using the [IsCommentsPanelVisible](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_IsCommentsPanelVisible) property. The default value of this property is false.
{% tabs %}
{% highlight c# %}
Expand All @@ -40,7 +40,7 @@ PdfViewer.IsCommentsPanelVisible = true;


## Comment panel
Annotation comments can be added to the PDF using the comment panel. Comment panel can be opened by using Built-in toolbar, In the toolbar you can see the comments button in the primary toolbar for desktop and top toolbar for mobile. The comment panel displays all annotations in the document along with their comments and replies, allowing you to add comments to any annotation and reply to existing comments or annotations.
Annotation comments can be added to the PDF using the comment panel. The comment panel can be opened using the built-in toolbar. In the toolbar, you can find the Comments button in the primary toolbar for desktop and in the top toolbar for mobile. The comment panel displays all annotations in the document along with their comments and replies, allowing you to add comments to any annotation and reply to existing comments or annotations.
The following image represents how to add the comments using the toolbar on the desktop.

![Annotations comments Built-in toolbar](Images/Annotations/desktop-comment.gif)
Expand All @@ -50,16 +50,16 @@ The following image represents how to add comments using the toolbar on mobile.
![Annotations comments Built-in toolbar](Images/Annotations/mobile-comment.gif)

## Adding comments or replies
Follow these steps to add comments or replies :
Follow these steps to add comments or replies:
1. Select the annotation in the PDF document and open the comment panel.
2. The corresponding comment thread is highlighted in the comment panel.
3. Add comments and replies using the comment panel.
4. Using the reply button in the comment panel, you can add a comment directly to a specific annotation, ensuring the discussion stays linked to that annotation.
3. Add a comment using the comment input area.
4. To reply to an existing comment or annotation, use the Reply button in the comment panel. This keeps the discussion linked to that annotation.
5. Multiple replies can be added to a comment.

## Add comments or replies programmatically
These can add comments or replies to existing annotations programmatically by accessing the specific annotation from the Annotations collection. This allows you to enhance collaboration and provide feedback directly within the PDF.
The following example explains how to add comments or replies to specific annotations in the PDF document.
You can add comments or replies to existing annotations programmatically by accessing the specific annotation from the Annotations collection. This allows you to enhance collaboration and provide feedback directly within the PDF.
The following example explains how to add comments or replies to a specific annotation in the PDF document.

{% tabs %}
{% highlight c# %}
Expand All @@ -77,22 +77,30 @@ annotation.Comments.Add(comment);
{% endhighlight %}
{% endtabs %}

## Editing the comments and comments replies of the annotations
Comments and replies can be edited through the context menu available under the More Options in the Comment Panel. Follow the steps below:
Select the annotation comment in the comment panel.

1. Click More options in the comment or reply to container.
2. Select Edit from the context menu.
3. An editable text box appears. Change the content of the comment or reply.
## Editing comments and replies
Comments and replies can be edited through the context menu available under More Options in the Comment Panel. Follow the steps below:
1. Select the annotation comment in the comment panel.
2. Click More Options in the comment or reply container.
3. Select Edit from the context menu.
4. An editable text box appears. Change the content of the comment or reply.

## Delete Comment or Comment Replies
Comments and replies can be deleted through the context menu available under the More Options in the Comment Panel. Follow the steps below:
## Deleting comments and replies
Comments and replies can be deleted through the context menu available under More Options in the Comment Panel. Follow the steps below:
1. Select the annotation comment in the comment panel.
2. Click More options in the comment or reply to container.
2. Click More Options in the comment or reply container.
3. Select Delete from the context menu.

**Note :** Deleting the root comment from the comment panel also deletes the associated annotation.
**Note:** Deleting the root comment from the comment panel also deletes the associated annotation.

## See Also
- [Add, Remove, and Modify Annotations](../add-remove-modify-annotations)
- [Annotations Overview](../annotations-overview)
- [Add, Remove, and Edit Annotations](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/add-remove-modify-annotations)
- [Annotations Overview](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/annotations-overview)
- [Annotation Collection](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/annotation-collection)
- [Ink](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/ink)
- [Shapes](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/shapes)
- [Stamps](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/stamps)
- [Sticky Notes](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/sticky-notes)
- [Free Text](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/free-text)
- [Text Markups](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/text-markups)
- [Signature](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/signature)
- [Toolbar](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/maui/toolbar)
Loading