Skip to content

Commit 94512d9

Browse files
1003205: Updated Review Corrections overview and TextMarkup Annotation
1 parent cd3af16 commit 94512d9

19 files changed

Lines changed: 394 additions & 372 deletions
37.9 KB
Loading
303 KB
Loading
275 KB
Loading
305 KB
Loading
288 KB
Loading
309 KB
Loading
290 KB
Loading
295 KB
Loading
361 KB
Loading

Document-Processing/PDF/PDF-Viewer/javascript-es6/annotations/annotation-types/Squiggly-annotation.md

Lines changed: 71 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ You can add squiggly annotations in two ways:
2424
* Select text in the PDF document and right-click it.
2525
* Choose **Squiggly** in the context menu.
2626

27-
![Squiggly context](../../images/squiggly_context.png)
27+
![Squiggly context](../annotation-images/squiggle-context.gif)
2828

2929
2. Using the annotation toolbar
3030
* Click the **Edit Annotation** button in the PDF Viewer toolbar to open the annotation toolbar.
3131
* Select **Squiggly** to enable squiggly mode.
3232
* Select text to add the squiggly annotation.
3333
* Alternatively, select text first and then click **Squiggly**.
3434

35-
![Squiggly toolbar](../../images/squiggly_button.png)
35+
![Squiggly toolbar](../annotation-images/squiggle-tool.gif)
3636

3737
N> When in pan mode, selecting a text markup annotation switches the PDF Viewer to text select mode.
3838

39+
### Enable Squiggly Mode
40+
3941
Enable/exit squiggly mode using the following code:
4042

4143
```html
@@ -127,34 +129,27 @@ document.getElementById('addSquiggly')?.addEventListener('click', () => {
127129

128130
## Edit Squiggly Annotation
129131

130-
### Edit squiggly annotation in UI
131-
132-
You can select and delete squiggly annotations directly in the viewer. Use the context menu or toolbar options as needed.
133-
134-
Delete the selected annotation in the following ways:
135-
136-
1. Using the Delete/Backspace key
137-
* Select the annotation.
138-
* Press Delete (or Backspace). The selected annotation is removed.
139-
140-
2. Using the annotation toolbar
141-
* Select the annotation.
142-
* Click **Delete Annotation** in the annotation toolbar. The selected annotation is removed.
143-
144-
![Delete button](../../images/delete_button.png)
145-
146-
#### Edit squiggly annotation properties in UI
132+
### Edit Squiggly annotation in UI
147133

148134
The color and opacity of the squiggly annotation can be edited using the Edit Color and Edit Opacity tools in the annotation toolbar.
149135

150-
- Edit color: Use the color palette in the Edit Color tool to change the annotation color.
136+
#### Edit color
137+
Use the color palette in the Edit Color tool to change the annotation color.
151138

152139
![Edit color](../../images/edit_color.png)
153140

154-
- Edit opacity: Use the range slider in the Edit Opacity tool to change annotation opacity.
141+
#### Edit opacity
142+
Use the range slider in the Edit Opacity tool to change annotation opacity.
155143

156144
![Edit opacity](../../images/edit_opacity.png)
157145

146+
#### Delete Squiggly annotation
147+
148+
- Select the annotation and press Delete, or
149+
- Click **Delete Annotation** in the annotation toolbar.
150+
151+
![Delete button](../../images/delete_button.png)
152+
158153
### Edit a squiggly annotation programmatically
159154

160155
To modify an existing squiggly annotation programmatically, use the editAnnotation() method.
@@ -240,58 +235,74 @@ pdfviewer.appendTo('#PdfViewer');
240235
{% endhighlight %}
241236
{% endtabs %}
242237

243-
## Perform undo and redo
244-
245-
The PDF Viewer supports undo and redo for squiggly annotations:
238+
## Set properties while adding Individual Annotation
246239

247-
* Adding squiggly annotations
248-
* Deleting squiggly annotations
249-
* Changing color or opacity
240+
Set properties for individual annotation before creating the control using `SquigglySettings`.
250241

251-
Undo and redo actions can be performed in the following ways:
242+
> After editing default color and opacity using the Edit Color and Edit Opacity tools, the values update to the selected settings.
252243
253-
1. Using keyboard shortcuts:
254-
After a squiggly annotation action, press Ctrl+Z to undo and Ctrl+Y to redo.
255-
2. Using the toolbar:
256-
Use the **Undo** and **Redo** tools in the toolbar.
244+
Refer to the following code snippet to set the default highlight settings.
257245

246+
```html
247+
<button id="squiggly">Add Squiggly</button>
248+
```
258249
{% tabs %}
259250
{% highlight ts tabtitle="Standalone" %}
260-
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields } from '@syncfusion/ej2-pdfviewer';
251+
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner, SquigglySettings} from '@syncfusion/ej2-pdfviewer';
261252

262-
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields);
253+
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner);
263254

264-
let pdfviewer: PdfViewer = new PdfViewer({
265-
documentPath:'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
266-
resourceUrl:"https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib"
267-
});
255+
const pdfviewer: PdfViewer = new PdfViewer();
256+
pdfviewer.documentPath = 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf';
257+
pdfviewer.resourceUrl = 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib';
268258
pdfviewer.appendTo('#PdfViewer');
269259

270-
document.getElementById('undo')?.addEventListener('click', ()=> {
271-
pdfviewer.undo();
272-
});
260+
//Apply Squiggly Settings while adding individual Annotation
261+
document.getElementById('squiggly')?.addEventListener('click', function () {
262+
pdfviewer.annotation.addAnnotation('Squiggly', {
263+
bounds: [{ x: 97, y: 110, width: 350, height: 14 }],
264+
pageNumber: 1,
265+
author: 'User 1',
266+
color: '#ffff00',
267+
opacity: 0.9
268+
} as SquigglySettings);
273269

274-
document.getElementById('redo')?.addEventListener('click', ()=> {
275-
pdfviewer.redo();
270+
pdfviewer.annotation.addAnnotation('Squiggly', {
271+
bounds: [{ x: 107, y: 220, width: 350, height: 14 }],
272+
pageNumber: 1,
273+
author: 'User 2',
274+
color: '#ff1010ff',
275+
opacity: 0.9
276+
} as SquigglySettings);
276277
});
277278
{% endhighlight %}
278279
{% highlight ts tabtitle="Server-Backed" %}
279-
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields } from '@syncfusion/ej2-pdfviewer';
280+
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner, SquigglySettings} from '@syncfusion/ej2-pdfviewer';
280281

281-
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields);
282+
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner);
282283

283-
let pdfviewer: PdfViewer = new PdfViewer({
284-
documentPath:'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf'
285-
});
284+
const pdfviewer: PdfViewer = new PdfViewer();
285+
pdfviewer.documentPath = 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf';
286286
pdfviewer.serviceUrl = 'https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer/';
287287
pdfviewer.appendTo('#PdfViewer');
288288

289-
document.getElementById('undo')?.addEventListener('click', ()=> {
290-
pdfviewer.undo();
291-
});
289+
//Apply Squiggly Settings while adding individual Annotation
290+
document.getElementById('squiggly')?.addEventListener('click', function () {
291+
pdfviewer.annotation.addAnnotation('Squiggly', {
292+
bounds: [{ x: 97, y: 110, width: 350, height: 14 }],
293+
pageNumber: 1,
294+
author: 'User 1',
295+
color: '#ffff00',
296+
opacity: 0.9
297+
} as SquigglySettings);
292298

293-
document.getElementById('redo')?.addEventListener('click', ()=> {
294-
pdfviewer.redo();
299+
pdfviewer.annotation.addAnnotation('Squiggly', {
300+
bounds: [{ x: 107, y: 220, width: 350, height: 14 }],
301+
pageNumber: 1,
302+
author: 'User 2',
303+
color: '#ff1010ff',
304+
opacity: 0.9
305+
} as SquigglySettings);
295306
});
296307
{% endhighlight %}
297308
{% endtabs %}
@@ -306,16 +317,21 @@ import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, Thumbnai
306317

307318
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation);
308319

309-
let pdfviewer: PdfViewer = new PdfViewer({ documentPath:'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf', enableTextMarkupAnnotation: false });
320+
let pdfviewer: PdfViewer = new PdfViewer();
321+
pdfviewer.documentPath= 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
322+
pdfviewer.resourceUrl = "https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib";
323+
pdfviewer.enableTextMarkupAnnotation= false;
310324
pdfviewer.appendTo('#PdfViewer');
311325
{% endhighlight %}
312326
{% highlight ts tabtitle="Server-Backed" %}
313327
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation } from '@syncfusion/ej2-pdfviewer';
314328

315329
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation);
316330

317-
let pdfviewer: PdfViewer = new PdfViewer({ documentPath:'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf', enableTextMarkupAnnotation: false });
331+
let pdfviewer: PdfViewer = new PdfViewer();
332+
pdfviewer.documentPath='https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
318333
pdfviewer.serviceUrl = 'https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer/';
334+
pdfviewer.enableTextMarkupAnnotation= false;
319335
pdfviewer.appendTo('#PdfViewer');
320336
{% endhighlight %}
321337
{% endtabs %}

0 commit comments

Comments
 (0)