Skip to content

Commit ae479f0

Browse files
996394: Updated UG for Annotation Section
1 parent 319f65b commit ae479f0

9 files changed

Lines changed: 1028 additions & 0 deletions

File tree

68.6 KB
Loading
63.6 KB
Loading
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
layout: post
3+
title: Annotations Permission in TypeScript PDF Viewer | Syncfusion
4+
description: Learn how to use annotation permission in Syncfusion TypeScript PDF Viewer using programmatic APIs.
5+
platform: document-processing
6+
control: PDF Viewer
7+
documentation: ug
8+
domainurl: ##DomainURL##
9+
---
10+
11+
# Annotation permissions
12+
13+
Use [annotationSettings](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#annotationsettings) to control creation-time permissions and behavior of annotations in the PDF Viewer.
14+
15+
## Common permissions
16+
17+
- isLock: Locks the annotation so it cannot be moved, resized, edited, or deleted.
18+
- skipPrint: Excludes annotations from the print output when the document is printed from the viewer.
19+
- skipDownload: Excludes annotations from the exported/downloaded document.
20+
21+
```ts
22+
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView,
23+
TextSelection, TextSearch, Print, Annotation, FormFields, FormDesigner,
24+
AllowedInteraction} from '@syncfusion/ej2-pdfviewer';
25+
26+
PdfViewer.Inject(Toolbar,Magnification,Navigation, LinkAnnotation,ThumbnailView,BookmarkView,
27+
TextSelection, TextSearch, Print, Annotation,FormFields, FormDesigner);
28+
29+
let viewer: PdfViewer = new PdfViewer();
30+
viewer.resourceUrl= 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib';
31+
viewer.documentPath= 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
32+
33+
// Default annotation settings applied to annotations created via the UI
34+
viewer.annotationSettings = {
35+
author: 'XYZ',
36+
minHeight: 10,
37+
minWidth: 10,
38+
maxWidth: 100,
39+
maxHeight: 100,
40+
isLock: false, // allow moving/resizing/editing by default
41+
skipPrint: false, // include annotations when printing the document
42+
skipDownload: false, // include annotations when downloading/exporting the document
43+
allowedInteractions: [AllowedInteraction.Resize],
44+
};
45+
46+
viewer.appendTo("#pdfViewer");
47+
```
48+
49+
## Individual permissions
50+
51+
- isPrint: Controls whether a specific annotation participates in printing. Set to false to prevent just that annotation from printing.
52+
- isLock: You can also lock/unlock a specific annotation instance programmatically.
53+
54+
```ts
55+
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields } from '@syncfusion/ej2-pdfviewer';
56+
57+
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields);
58+
59+
const pdfviewer: PdfViewer = new PdfViewer({
60+
documentPath: 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
61+
resourceUrl = "https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib",
62+
// Text markup defaults
63+
highlightSettings: { author: 'QA', subject: 'Review', color: '#ffff00', opacity: 0.6 },
64+
strikethroughSettings: { author: 'QA', subject: 'Remove', color: '#ff0000', opacity: 0.6 },
65+
underlineSettings: { author: 'Guest User', subject: 'Points to be remembered', color: '#00ffff', opacity: 0.9 },
66+
squigglySettings: { author: 'Guest User', subject: 'Corrections', color: '#00ff00', opacity: 0.9 },
67+
68+
// Shapes
69+
lineSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, isLock: false, isPrint: true },
70+
arrowSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, isLock: false, isPrint: true },
71+
rectangleSettings: { fillColor: '#ffffff00', strokeColor: '#222222', thickness: 1, opacity: 1, isLock: false, isPrint: true },
72+
circleSettings: { fillColor: '#ffffff00', strokeColor: '#222222', thickness: 1, opacity: 1, isLock: false, isPrint: true },
73+
polygonSettings: { fillColor: '#ffffff00', strokeColor: '#222222', thickness: 1, opacity: 1, isLock: false, isPrint: true },
74+
75+
// Measurements
76+
distanceSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, isLock: false, isPrint: true },
77+
perimeterSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, isLock: false, isPrint: true },
78+
areaSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, fillColor: '#ffffff00', isLock: false, isPrint: true },
79+
radiusSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, fillColor: '#ffffff00', isLock: false, isPrint: true },
80+
volumeSettings: { strokeColor: '#0066ff', thickness: 2, opacity: 0.8, fillColor: '#ffffff00', isLock: false, isPrint: true },
81+
82+
// Others
83+
freeTextSettings: { borderColor: '#222222', opacity: 1, isLock: false, isPrint: true },
84+
inkAnnotationSettings: { strokeColor: '#0000ff', thickness: 3, opacity: 0.8, isLock: false, isPrint: true },
85+
stampSettings: { opacity: 0.9, isLock: false, isPrint: true },
86+
stickyNotesSettings: { author: 'QA', subject: 'Review', opacity: 1, isLock: false, isPrint: true }
87+
});
88+
89+
pdfviewer.appendTo('#PdfViewer');
90+
```
91+
92+
Behavior notes
93+
- isLock true: The annotation is locked; users cannot move, resize, or edit it through the UI until it is unlocked.
94+
- skipPrint true: All annotations are omitted from the print output initiated from the viewer.
95+
- skipDownload true: All annotations are omitted from the exported/downloaded PDF from the viewer.
96+
- isPrint on an individual annotation: Use this when you only want to exclude a particular annotation from printing while leaving others printable.
97+
98+
[View Sample on GitHub](https://github.com/SyncfusionExamples/typescript-pdf-viewer-examples/tree/master)

0 commit comments

Comments
 (0)