{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "pdf-viewer-redaction",
  "framework": "vue",
  "type": "registry:component",
  "component": "PdfViewer",
  "variant": "redaction",
  "dependencies": [
    "@syncfusion/ej2-vue-pdfviewer"
  ],
  "description": "PDF viewer sample marking sensitive regions or searched text for permanent redaction.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/vue/llms.txt",
    "skillPack": "syncfusion/vue-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/vue/pdf-viewer-redaction.md"
  },
  "files": [
    {
      "target": "src/components/pdf-viewer-redaction/PdfViewer.vue",
      "content": "<template>\n  <div class=\"control-section redaction\">\n    <div class=\"controls\" role=\"group\" aria-label=\"Redaction controls\">\n      <button class=\"e-btn e-primary\" type=\"button\" :disabled=\"!loaded\" @click=\"addRedaction\">Add Redaction</button>\n      <label for=\"redaction-search\">Text to redact</label>\n      <input id=\"redaction-search\" v-model=\"searchText\" class=\"e-input\" type=\"search\" :disabled=\"!loaded || searching\" />\n      <button class=\"e-btn\" type=\"button\" :disabled=\"!loaded || searching\" @click=\"searchAndMark\">{{ searching ? 'Searching...' : 'Search & Mark' }}</button>\n      <button class=\"e-btn e-danger\" type=\"button\" :disabled=\"!loaded\" @click=\"applyRedactions\">Apply Redactions</button>\n    </div>\n    <p role=\"status\">{{ statusMessage }}</p>\n    <ejs-pdfviewer id=\"pdfviewer\" ref=\"pdfviewer\" :documentPath=\"documentPath\" :resourceUrl=\"resourceUrl\" :isExtractText=\"true\" :toolbarSettings=\"toolbarSettings\" :documentLoad=\"documentLoad\" />\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer } from '@syncfusion/ej2-vue-pdfviewer';\n\nexport default {\n  components: { 'ejs-pdfviewer': PdfViewerComponent },\n  data() {\n    return {\n      documentPath: 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',\n      resourceUrl: 'https://cdn.syncfusion.com/ej2/35.1.37/dist/ej2-pdfviewer-lib',\n      loaded: false, searching: false, searchText: '', statusMessage: 'Loading PDF document...',\n      toolbarSettings: { showTooltip: true, toolbarItems: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'SubmitForm', 'AnnotationEditTool', 'RedactionEditTool', 'FormDesignerEditTool', 'SearchOption', 'PrintOption', 'DownloadOption'] }\n    };\n  },\n  provide: { PdfViewer: [Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer] },\n  methods: {\n    documentLoad() {\n      const viewer = (this.$refs.pdfviewer as any).ej2Instances;\n      viewer.toolbar.showRedactionToolbar(true);\n      this.loaded = true;\n      this.statusMessage = 'Document loaded. Add a redaction or search for text to mark.';\n    },\n    addRedaction() {\n      const viewer = (this.$refs.pdfviewer as any).ej2Instances;\n      viewer.annotation.addAnnotation('Redaction', { bound: { x: 150, y: 400, width: 200, height: 40 }, pageNumber: viewer.currentPageNumber, overlayText: 'Confidential', fillColor: '#000000', fontColor: '#FFFFFF' });\n      this.statusMessage = 'Redaction added. Apply Redactions to make it permanent.';\n    },\n    async searchAndMark() {\n      const term = this.searchText.trim();\n      if (!term) { this.statusMessage = 'Enter text to search for and redact.'; return; }\n      this.searching = true;\n      this.statusMessage = `Searching for \"${term}\"...`;\n      try {\n        const viewer = (this.$refs.pdfviewer as any).ej2Instances;\n        const results = await viewer.textSearchModule.findTextAsync(term, false);\n        let count = 0;\n        results.forEach((result: any) => (result.bounds || []).forEach((bound: any) => {\n          viewer.annotation.addAnnotation('Redaction', { bound: { x: bound.x * 96 / 72, y: bound.y * 96 / 72, width: bound.width * 96 / 72, height: bound.height * 96 / 72 }, pageNumber: result.pageIndex + 1, overlayText: 'Confidential', fillColor: '#000000', fontColor: '#FFFFFF' });\n          count++;\n        }));\n        this.statusMessage = count ? `Marked ${count} match${count === 1 ? '' : 'es'} for \"${term}\". Apply Redactions to make them permanent.` : `No matches found for \"${term}\".`;\n      } catch (error) {\n        console.error('Unable to search the PDF for redaction text.', error);\n        this.statusMessage = 'Unable to search the PDF. See the browser console for details.';\n      } finally { this.searching = false; }\n    },\n    applyRedactions() {\n      if (!window.confirm('Applying redactions permanently removes the marked content. Continue?')) { this.statusMessage = 'Redaction application canceled.'; return; }\n      (this.$refs.pdfviewer as any).ej2Instances.annotation.redact();\n      this.statusMessage = 'Applying redactions. The viewer will reload when processing is complete.';\n    }\n  }\n};\n</script>\n\n<style scoped>\n.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 8px; }\n.controls label { font-weight: 600; }\n.controls input { width: 220px; }\n#pdfviewer { height: 640px; }\n</style>\n"
    }
  ]
}