{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "pdf-viewer-form-designer",
  "framework": "react",
  "type": "registry:component",
  "component": "PdfViewer",
  "variant": "form-designer",
  "dependencies": [
    "@syncfusion/ej2-react-dropdowns",
    "@syncfusion/ej2-react-pdfviewer"
  ],
  "description": "PDF viewer adds configurable form fields to the current page with a field-type dropdown and document-load gating.",
  "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/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/js/pdf-viewer-form-designer.md"
  },
  "files": [
    {
      "target": "src/components/pdf-viewer-form-designer/PdfViewer.jsx",
      "content": "import { useRef, useState } from 'react';\nimport { DropDownListComponent } from '@syncfusion/ej2-react-dropdowns';\nimport {\n    Annotation, BookmarkView, FormDesigner, FormFields, Inject, LinkAnnotation, Magnification,\n    Navigation, PageOrganizer, PdfViewerComponent, Print, TextSearch, TextSelection, ThumbnailView,\n    Toolbar\n} from '@syncfusion/ej2-react-pdfviewer';\n\nconst fieldTypes = [\n    { text: 'Textbox', value: 'Textbox' },\n    { text: 'Password', value: 'Password' },\n    { text: 'Checkbox', value: 'CheckBox' },\n    { text: 'Radio button', value: 'RadioButton' },\n    { text: 'Dropdown', value: 'DropDown' },\n    { text: 'List box', value: 'ListBox' },\n    { text: 'Signature', value: 'SignatureField' },\n    { text: 'Initial', value: 'InitialField' },\n    { text: 'Button', value: 'ButtonField' }\n];\n\nconst fieldTypeFields = { text: 'text', value: 'value' };\n\nfunction FormDesignerSample() {\n    const viewerRef = useRef(null);\n    const fieldNumber = useRef(0);\n    const [fieldType, setFieldType] = useState('Textbox');\n    const [isDocumentLoaded, setIsDocumentLoaded] = useState(false);\n\n    const addFormField = () => {\n        const viewer = viewerRef.current;\n        if (!viewer) {\n            return;\n        }\n\n        const currentField = fieldNumber.current++;\n        const settings = {\n            name: `${fieldType}_${currentField + 1}`,\n            pageNumber: viewer.currentPageNumber,\n            bounds: {\n                X: 100 + (currentField % 2) * 240,\n                Y: 120 + (Math.floor(currentField / 2) % 8) * 55,\n                Width: 200,\n                Height: 32\n            },\n            ...(fieldType === 'DropDown' || fieldType === 'ListBox'\n                ? {\n                    options: [\n                        { itemName: 'Option 1', itemValue: 'Option 1' },\n                        { itemName: 'Option 2', itemValue: 'Option 2' },\n                        { itemName: 'Option 3', itemValue: 'Option 3' }\n                    ]\n                }\n                : {})\n        };\n\n        viewer.formDesigner.addFormField(fieldType, settings);\n    };\n\n    return (\n        <div className='control-section'>\n            <div\n                role='group'\n                aria-label='Form field controls'\n                style={{ display: 'flex', alignItems: 'flex-end', gap: '12px', marginBottom: '12px' }}\n            >\n                <div style={{ width: '220px' }}>\n                    <label htmlFor='form-field-type' style={{ display: 'block', marginBottom: '4px' }}>\n                        Form Field Type\n                    </label>\n                    <DropDownListComponent\n                        id='form-field-type'\n                        dataSource={fieldTypes}\n                        fields={fieldTypeFields}\n                        value={fieldType}\n                        change={(event) => {\n                            if (typeof event.value === 'string') {\n                                setFieldType(event.value);\n                            }\n                        }}\n                        enabled={isDocumentLoaded}\n                        width='100%'\n                    />\n                </div>\n                <button\n                    className='e-btn e-primary'\n                    type='button'\n                    onClick={addFormField}\n                    disabled={!isDocumentLoaded}\n                >\n                    Add Form Field\n                </button>\n            </div>\n            <p role='status'>\n                {isDocumentLoaded\n                    ? 'Adds the selected field to the currently displayed page.'\n                    : 'Loading PDF document...'}\n            </p>\n            <PdfViewerComponent\n                id='form-designer-viewer'\n                ref={viewerRef}\n                documentPath='https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf'\n                resourceUrl='https://cdn.syncfusion.com/ej2/35.1.37/dist/ej2-pdfviewer-lib'\n                documentLoad={() => setIsDocumentLoaded(true)}\n                style={{ height: '640px' }}\n            >\n                <Inject services={[\n                    Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView,\n                    Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer\n                ]} />\n            </PdfViewerComponent>\n        </div>\n    );\n}\n\nexport default FormDesignerSample;\n"
    }
  ]
}