Identify added annotation mode in Vue PDF Viewer
Determine whether an added annotation was UI-drawn, imported, or existing using the annotationAddMode property of the annotationSelect event.
Step 1: Follow the steps in the Get started with Vue PDF Viewer guide to create a sample.
Step 2: Use the following code to identify the added annotation mode.
<template>
<div>
<ejs-pdfviewer
ref="viewer"
:serviceUrl="serviceUrl"
:documentPath="documentPath"
:annotationSelect="onAnnotationSelect">
</ejs-pdfviewer>
</div>
</template><script>
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields } from '@syncfusion/ej2-vue-pdfviewer';
export default {
name: 'IdentifyAnnotationMode',
components: { 'ejs-pdfviewer': PdfViewerComponent },
provide: {
PdfViewer: [
Toolbar,
Magnification,
Navigation,
LinkAnnotation,
BookmarkView,
ThumbnailView,
Print,
TextSelection,
TextSearch,
Annotation,
FormDesigner,
FormFields
]
},
data() {
return {
serviceUrl: 'https://ej2services.syncfusion.com/production/web-services/api/pdfviewer',
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf'
};
},
methods: {
onAnnotationSelect(args) {
console.log(args.annotationAddMode);
}
}
};
</script>