{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "pdf-viewer-redaction",
  "framework": "angular",
  "type": "registry:component",
  "component": "PdfViewer",
  "variant": "redaction",
  "dependencies": [
    "@syncfusion/ej2-angular-pdfviewer"
  ],
  "description": "Search PDF text or place redaction marks, then apply them permanently to remove sensitive content.",
  "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/angular/llms.txt",
    "skillPack": "syncfusion/angular-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/angular/pdf-viewer-redaction.md"
  },
  "files": [
    {
      "target": "src/components/pdf-viewer-redaction/pdf-viewer.component.html",
      "content": "<div class=\"control-section\">\n    <div role=\"group\" aria-label=\"Redaction controls\"\n        style=\"display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px;margin-bottom:12px\">\n        <button class=\"e-btn e-primary\" type=\"button\" (click)=\"addRedaction()\" [disabled]=\"!isDocumentLoaded\">\n            Add Redaction\n        </button>\n        <div style=\"width:220px\">\n            <label for=\"redaction-search-text\" style=\"display:block;margin-bottom:4px\">Text to redact</label>\n            <input id=\"redaction-search-text\" class=\"e-input\" type=\"search\" [value]=\"searchText\"\n                (input)=\"onSearchTextInput($event)\" [disabled]=\"!isDocumentLoaded || isSearching\">\n        </div>\n        <button class=\"e-btn\" type=\"button\" (click)=\"searchAndMarkRedactions()\"\n            [disabled]=\"!isDocumentLoaded || isSearching\">\n            {{ isSearching ? 'Searching...' : 'Search & Mark for Redaction' }}\n        </button>\n        <button class=\"e-btn e-danger\" type=\"button\" (click)=\"applyRedactions()\" [disabled]=\"!isDocumentLoaded\">\n            Apply Redactions\n        </button>\n    </div>\n    <p role=\"status\">{{ statusMessage }}</p>\n    <ejs-pdfviewer #pdfviewer id=\"redaction-viewer\" [documentPath]=\"document\" [resourceUrl]=\"resource\"\n        [isExtractText]=\"true\"\n        [toolbarSettings]=\"{ showTooltip: true, toolbarItems: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'SubmitForm', 'AnnotationEditTool', 'RedactionEditTool', 'FormDesignerEditTool', 'SearchOption', 'PrintOption', 'DownloadOption'] }\"\n        (documentLoad)=\"onDocumentLoad()\" style=\"height:640px;display:block\">\n    </ejs-pdfviewer>\n</div>\n"
    },
    {
      "target": "src/components/pdf-viewer-redaction/pdf-viewer.component.ts",
      "content": "import { Component, ViewChild } from '@angular/core';\nimport {\n    AnnotationService,\n    BookmarkViewService,\n    FormDesignerService,\n    FormFieldsService,\n    LinkAnnotationService,\n    MagnificationService,\n    NavigationService,\n    PageOrganizerService,\n    PdfViewerComponent,\n    PdfViewerModule,\n    PrintService,\n    RedactionSettings,\n    TextSearchService,\n    TextSelectionService,\n    ThumbnailViewService,\n    ToolbarService\n} from '@syncfusion/ej2-angular-pdfviewer';\n\ntype AnnotationSettings = NonNullable<Parameters<PdfViewerComponent['annotation']['addAnnotation']>[1]>;\n\n@Component({\n    selector: 'control-content',\n    templateUrl: 'pdf-viewer.component.html',\n    providers: [\n        LinkAnnotationService, BookmarkViewService, MagnificationService, ThumbnailViewService,\n        ToolbarService, NavigationService, TextSearchService, TextSelectionService, PrintService,\n        AnnotationService, FormFieldsService, FormDesignerService, PageOrganizerService\n    ],\n    standalone: true,\n    imports: [PdfViewerModule]\n})\nexport class RedactionComponent {\n    @ViewChild('pdfviewer')\n    public pdfviewerControl!: PdfViewerComponent;\n\n    public readonly resource = 'https://cdn.syncfusion.com/ej2/35.1.37/dist/ej2-pdfviewer-lib';\n    public readonly document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';\n    public isDocumentLoaded = false;\n    public searchText = '';\n    public isSearching = false;\n    public statusMessage = 'Loading PDF document...';\n    private isApplyingRedactions = false;\n\n    public onDocumentLoad(): void {\n        this.pdfviewerControl.toolbar.showRedactionToolbar(true);\n        this.isDocumentLoaded = true;\n        if (this.isApplyingRedactions) {\n            this.isApplyingRedactions = false;\n            this.statusMessage = 'Redactions applied to the document.';\n        } else {\n            this.statusMessage = 'Document loaded. Add a redaction or search for text to mark.';\n        }\n    }\n\n    public onSearchTextInput(event: Event): void {\n        this.searchText = (event.currentTarget as HTMLInputElement).value;\n    }\n\n    public addRedaction(): void {\n        this.pdfviewerControl.annotation.addAnnotation('Redaction', {\n            bound: { x: 150, y: 400, width: 200, height: 40 },\n            pageNumber: this.pdfviewerControl.currentPageNumber,\n            overlayText: 'Confidential',\n            fillColor: '#000000',\n            fontColor: '#FFFFFF'\n        } as RedactionSettings);\n        this.statusMessage = 'Redaction added to the current page. Apply Redactions to make it permanent.';\n    }\n\n    public async searchAndMarkRedactions(): Promise<void> {\n        const term = this.searchText.trim();\n        if (!term) {\n            this.statusMessage = 'Enter text to search for and redact.';\n            return;\n        }\n\n        this.isSearching = true;\n        this.statusMessage = `Searching for \"${term}\"...`;\n        try {\n            const results = await this.pdfviewerControl.textSearchModule.findTextAsync(term, false);\n            let redactionCount = 0;\n\n            for (const result of results) {\n                if (typeof result.pageIndex !== 'number' || !result.bounds?.length) {\n                    continue;\n                }\n\n                for (const bound of result.bounds) {\n                    this.pdfviewerControl.annotation.addAnnotation('Redaction', {\n                        bound: {\n                            x: bound.x * (96 / 72),\n                            y: bound.y * (96 / 72),\n                            width: bound.width * (96 / 72),\n                            height: bound.height * (96 / 72)\n                        },\n                        pageNumber: result.pageIndex + 1,\n                        overlayText: 'Confidential',\n                        fillColor: '#000000',\n                        fontColor: '#FFFFFF'\n                    } as AnnotationSettings);\n                    redactionCount++;\n                }\n            }\n\n            this.statusMessage = redactionCount\n                ? `Marked ${redactionCount} match${redactionCount === 1 ? '' : 'es'} for \"${term}\". Apply Redactions to make them permanent.`\n                : `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 {\n            this.isSearching = false;\n        }\n    }\n\n    public applyRedactions(): void {\n        if (!window.confirm('Applying redactions permanently removes the marked content. Continue?')) {\n            this.statusMessage = 'Redaction application canceled.';\n            return;\n        }\n\n        this.isApplyingRedactions = true;\n        this.pdfviewerControl.annotation.redact();\n        this.statusMessage = 'Applying redactions. The viewer will reload when processing is complete.';\n    }\n}\n"
    }
  ]
}