Skip to content

Commit a57baee

Browse files
authored
Merge pull request #1941 from syncfusion-content/Maui-Pdf
Added UG for AnnotationLoaded Event and Annotations comment for .NET MAUI PDFViewer
2 parents 5e255f8 + 3fe49d2 commit a57baee

File tree

5 files changed

+117
-1
lines changed

5 files changed

+117
-1
lines changed

Document-Processing-toc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,7 @@
16061606
<li><a href="/document-processing/pdf/pdf-viewer/maui/Import-Export-Annotations">Import and Export</a></li>
16071607
<li><a href="/document-processing/pdf/pdf-viewer/maui/Undo-Redo">Undo and Redo</a></li>
16081608
<li><a href="/document-processing/pdf/pdf-viewer/maui/Show-Hide">Show and Hide</a></li>
1609+
<li><a href="/document-processing/pdf/pdf-viewer/maui/Annotations-Comment">Annotation Comments</a></li>
16091610
<li>
16101611
Types
16111612
<ul>

Document-Processing/PDF/PDF-Viewer/maui/Annotation-Collection.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,25 @@ private void OnDocumentLoaded(object sender, EventArgs e)
3939
}
4040
}
4141
{% endhighlight %}
42-
{% endtabs %}
42+
{% endtabs %}
43+
44+
## AnnotationsLoaded event
45+
The 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.
46+
The following example explains how to wire and handle the event.
47+
48+
{% tabs %}
49+
{% highlight c# %}
50+
51+
void WireAnnotationsLoadedEvent()
52+
{
53+
// Wire the annotations loaded event of [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html).
54+
pdfViewer.AnnotationsLoaded += OnAnnotationsLoaded;
55+
}
56+
57+
private void OnAnnotationsLoaded(object? sender, EventArgs e)
58+
{
59+
Debug.WriteLine("All annotations have been loaded.");
60+
}
61+
62+
{% endhighlight %}
63+
{% endtabs %}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
layout: post
3+
title: Comments in .NET MAUI PDF Viewer | Syncfusion
4+
description: Learn here all about how to add comments or replies to annotations in Syncfusion<sup>®</sup> .NET MAUI PDF Viewer (SfPdfViewer) control.
5+
platform: document-processing
6+
control: SfPdfViewer
7+
documentation: ug
8+
keywords: .net maui pdf viewer, .net maui view pdf, pdf viewer in .net maui, .net maui open pdf, maui pdf viewer, maui pdf view
9+
---
10+
11+
# Comments in .NET MAUI PDF Viewer (SfPdfViewer)
12+
The PDF Viewer control provides options to add, edit, and delete comments for the following annotations in PDF documents:
13+
1. Ink annotation
14+
2. Shape annotation
15+
3. Stamp annotation
16+
4. Sticky note annotation
17+
5. Text markup annotation
18+
6. Free text annotation
19+
7. Signature annotation
20+
21+
## Showing/Hiding the Comment panel
22+
The built-in Comment Panel in the PDF Viewer displays annotation comments. You can show or hide this panel using the IsCommentsPanelVisible property. The default value of this property is false.
23+
{% tabs %}
24+
{% highlight c# %}
25+
26+
// Show the comment panel in the PDF Viewer
27+
PdfViewer.IsCommentsPanelVisible = true;
28+
29+
{% endhighlight %}
30+
{% endtabs %}
31+
32+
{% tabs %}
33+
{% highlight XAML %}
34+
35+
<syncfusion:SfPdfViewer x:Name="PdfViewer" IsCommentsPanelVisible = "True" >
36+
</syncfusion:SfPdfViewer>
37+
38+
{% endhighlight %}
39+
{% endtabs %}
40+
41+
42+
## Comment panel
43+
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.
44+
The following image represents how to add the comments using the toolbar on the desktop.
45+
46+
![Annotations comments Built-in toolbar](Images/Annotations/desktop-comment.gif)
47+
48+
The following image represents how to add comments using the toolbar on mobile.
49+
50+
![Annotations comments Built-in toolbar](Images/Annotations/mobile-comment.gif)
51+
52+
## Adding comments or replies
53+
Follow these steps to add comments or replies :
54+
1. Select the annotation in the PDF document and open the comment panel.
55+
2. The corresponding comment thread is highlighted in the comment panel.
56+
3. Add comments and replies using the comment panel.
57+
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.
58+
5. Multiple replies can be added to a comment.
59+
60+
## Add comments or replies programmatically
61+
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.
62+
The following example explains how to add comments or replies to specific annotations in the PDF document.
63+
64+
{% tabs %}
65+
{% highlight c# %}
66+
67+
ReadOnlyObservableCollection<Annotation> annotations = pdfViewer.Annotations;
68+
Annotation annotation = annotations[0];
69+
Comment comment = new Comment()
70+
{
71+
Text = "First Annotations",
72+
Author="User Name",
73+
ModifiedDate= DateTime.Now,
74+
};
75+
annotation.Comments.Add(comment);
76+
77+
{% endhighlight %}
78+
{% endtabs %}
79+
80+
## Editing the comments and comments replies of the annotations
81+
Comments and replies can be edited through the context menu available under the More Options in the Comment Panel. Follow the steps below:
82+
Select the annotation comment in the comment panel.
83+
84+
1. Click More options in the comment or reply to container.
85+
2. Select Edit from the context menu.
86+
3. An editable text box appears. Change the content of the comment or reply.
87+
88+
## Delete Comment or Comment Replies
89+
Comments and replies can be deleted through the context menu available under the More Options in the Comment Panel. Follow the steps below:
90+
1. Select the annotation comment in the comment panel.
91+
2. Click More options in the comment or reply to container.
92+
3. Select Delete from the context menu.
93+
94+
**Note :** Deleting the root comment from the comment panel also deletes the associated annotation.
497 KB
Loading
452 KB
Loading

0 commit comments

Comments
 (0)