Skip to content

Commit 242dfcc

Browse files
Merge pull request #916 from Syncfusion-Content/development
DOCINFRA-2341_merged_using_automation
2 parents 2965201 + e2079b9 commit 242dfcc

File tree

6 files changed

+159
-2
lines changed

6 files changed

+159
-2
lines changed

Flutter/Release-notes/v26.2.4.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Essential Studio for Flutter 2024 Volume 2 SP Release Release Notes
3+
description: Essential Studio for Flutter 2024 Volume 2 SP Release Release Notes
4+
platform: flutter
5+
documentation: ug
6+
---
7+
8+
# Essential Studio for Flutter Release Notes
9+
10+
{% include release-info.html date="July 24, 2024" version="v26.2.4" %}
11+
12+
{% directory path: _includes/release-notes/v26.2.4 %}
13+
14+
{% include {{file.url}} %}
15+
16+
{% enddirectory %}

Flutter/pdf-viewer/annotations-overview.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: post
33
title: Annotations in Flutter PDF Viewer widget | Syncfusion
44
description: Learn here all about annotations feature of the Syncfusion Flutter PDF Viewer (SfPdfViewer) widget and more.
5-
platform: Flutter
5+
platform: flutter
66
control: SfPdfViewer
77
documentation: ug
88
---
@@ -18,3 +18,4 @@ The `SfPdfViewer` supports the following annotation types.
1818
2. Squiggly
1919
3. Strikethrough
2020
4. Underline
21+
5. Sticky note
Loading
Loading

Flutter/pdf-viewer/sticky-notes.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
layout: post
3+
title: Sticky Note Annotations in Flutter PDF Viewer Widget | Syncfusion
4+
description: Learn here all about sticky note annotations in the Syncfusion Flutter PDF Viewer (SfPdfViewer) widget and more.
5+
platform: flutter
6+
control: SfPdfViewer
7+
documentation: ug
8+
---
9+
10+
# Sticky Note Annotations in Flutter PDF Viewer Widget (Syncfusion)
11+
12+
The sticky note annotation feature of `SfPdfViewer` allows you to add, remove, and modify sticky notes in a PDF document. This feature will help add comments or notes to specific parts of a document to clarify complex concepts, terms, or ideas. This section will cover the various functions available in `SfPdfViewer` for working with sticky note annotations.
13+
14+
## Types of sticky notes
15+
16+
The following sticky note icon types are currently available in `SfPdfViewer`. The icon types can be selected from the [PdfStickyNoteIcon](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfStickyNoteIcon.html) enumeration.
17+
18+
![Sticky note icon types](images/annotations/sticky-note-icon-types.png)
19+
20+
## Add sticky notes
21+
22+
This section will go through how to add sticky note annotations to a PDF document interactively and programmatically.
23+
24+
### Add sticky notes from annotation mode
25+
26+
You can add sticky note annotations to a PDF document by tapping with a touch (or mouse down) on a PDF page. The following steps explain how to add sticky note annotations to a PDF:
27+
28+
1. Set the [annotationMode](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/annotationMode.html) property of the PdfViewerController to `stickyNote`. This activates the sticky note mode on the control.
29+
2. Tap (or mouse down) on a PDF page, where you want to add the sticky note annotation. This will add a sticky note with a default style and a popup will be displayed to write and submit the text.
30+
4. You can later select and edit the annotations, if required.
31+
5. If you need to disable the [annotationMode](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/annotationMode.html) of `stickyNote`, you need to change the [annotationMode](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/annotationMode.html) to `none`.
32+
33+
The following code explains how to enable the sticky note annotation mode.
34+
35+
{% tabs %}
36+
{% highlight dart %}
37+
38+
void enableStickyNoteAnnotationMode() {
39+
// Enable the sticky note annotation mode.
40+
_pdfViewerController.annotationMode = PdfAnnotationMode.stickyNote;
41+
}
42+
43+
{% endhighlight %}
44+
{% endtabs %}
45+
46+
Similarly, refer to following code to disable the stickyNote annotation mode.
47+
48+
{% tabs %}
49+
{% highlight dart %}
50+
51+
void disableAnnotationMode() {
52+
// Disable or deactivate the annotation mode.
53+
_pdfViewerController.annotationMode = PdfAnnotationMode.none;
54+
}
55+
56+
{% endhighlight %}
57+
{% endtabs %}
58+
59+
### Add sticky note annotation programmatically
60+
61+
You can create and add a sticky note annotation to a PDF document programmatically using the [addAnnotation](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/addAnnotation.html) method of the [PdfViewerController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController-class.html). The following example explains how to create a sticky note with a comment icon and add it to the first page of a PDF document.
62+
63+
{% tabs %}
64+
{% highlight dart hl_lines="18" %}
65+
66+
void addStickyNoteAnnotation() {
67+
// Create a sticky note annotation
68+
final StickyNoteAnnotation stickyNote = StickyNoteAnnotation(
69+
// Set the page number for the sticky note annotation
70+
pageNumber: 1,
71+
// Set the text for the sticky note annotation
72+
text: 'This is a sticky note annotation',
73+
// Set the icon for the sticky note annotation
74+
icon: PdfStickyNoteIcon.comment,
75+
// Set the position for the sticky note annotation
76+
position: const Offset(100, 100),
77+
);
78+
79+
// Set the color for the sticky note annotation
80+
stickyNote.color = Colors.yellow;
81+
82+
// Add the sticky note annotation to the PDF viewer
83+
_pdfViewerController.addAnnotation(stickyNote);
84+
}
85+
86+
{% endhighlight %}
87+
{% endtabs %}
88+
89+
## Sticky note annotation settings
90+
91+
In the sticky note annotation mode, the annotation will be added with a default appearance. You can modify the annotation after it has been added to the pages. However, if you need to define the appearance before adding sticky note annotations to the document, you can change its default settings using the [PdfViewerController.annotationSettings.stickyNote](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfAnnotationSettings/stickyNote.html). For that, you need to obtain the default sticky note annotation settings.
92+
93+
The following example explains how to obtain the default sticky note annotation settings and modify some of their properties. Similarly, you can modify all the other properties.
94+
95+
{% tabs %}
96+
{% highlight dart %}
97+
98+
void customizeDefaultStickyNoteSettings() {
99+
// Obtain the default sticky note annotation settings from the PdfViewerController instance.
100+
PdfStickyNoteAnnotationSettings stickyNoteSettings =
101+
_pdfViewerController.annotationSettings.stickyNote;
102+
103+
// Modify the default properties.
104+
stickyNoteSettings.icon =
105+
PdfStickyNoteIcon.comment; // Set the default icon to Comment.
106+
stickyNoteSettings.color = Colors.yellow; //Stroke color
107+
stickyNoteSettings.opacity = 0.75; // 75% Opacity
108+
}
109+
110+
{% endhighlight %}
111+
{% endtabs %}
112+
113+
## Edit the selected sticky note annotation
114+
115+
### Edit the text using UI interaction
116+
117+
When you double-tap the selected sticky note, the text editor opens. Edit the text and click "Save" to modify the text.
118+
119+
![Sticky note editing](images/annotations/sticky-notes-edit.gif)
120+
121+
### Edit sticky note properties programmatically
122+
123+
Edit the properties of the selected sticky note annotation programmatically by accessing the selected annotation instance. The selected annotation instance may be obtained from the [onAnnotationSelected](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onAnnotationSelected.html) callback. The following example shows how to edit the text and icon of the selected sticky note annotation. Similarly, you can modify the other properties.
124+
125+
{% tabs %}
126+
{% highlight dart %}
127+
128+
void editSelectedStickyNoteAnnotation(Annotation selectedAnnotation) {
129+
if (selectedAnnotation is StickyNoteAnnotation) {
130+
// Change the icon of the selected sticky note annotation to Note.
131+
selectedAnnotation.icon = PdfStickyNoteIcon.note;
132+
133+
// Change the text of the selected sticky note annotation.
134+
selectedAnnotation.text = "Changed the comment to note.";
135+
}
136+
}
137+
138+
{% endhighlight %}
139+
{% endtabs %}

0 commit comments

Comments
 (0)