# pdf-viewer-form-designer

> Create text, checkbox, dropdown, signature, and other form fields on the current PDF page.

**Framework:** angular  **Component:** PdfViewer  **Variant:** form-designer

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/angular/pdf-viewer-form-designer.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-angular-pdfviewer @syncfusion/ej2-angular-dropdowns
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/pdf-viewer-form-designer/pdf-viewer.component.html

```html
<div class="control-section">
    <div role="group" aria-label="Form field controls"
        style="display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px;margin-bottom:12px">
        <div style="width:220px">
            <label for="form-field-type" style="display:block;margin-bottom:4px">Form Field Type</label>
            <ejs-dropdownlist id="form-field-type" [dataSource]="fieldTypes" [fields]="fieldTypeFields"
                [value]="fieldType" [enabled]="isDocumentLoaded" (change)="onFieldTypeChange($event)">
            </ejs-dropdownlist>
        </div>
        <button class="e-btn e-primary" type="button" (click)="addFormField()" [disabled]="!isDocumentLoaded">
            Add Form Field
        </button>
    </div>
    <p role="status">
        {{ isDocumentLoaded ? 'Adds the selected field to the currently displayed page.' : 'Loading PDF document...' }}
    </p>
    <ejs-pdfviewer #pdfviewer id="form-designer-viewer" [documentPath]="document" [resourceUrl]="resource"
        (documentLoad)="onDocumentLoad()" style="height:640px;display:block">
    </ejs-pdfviewer>
</div>

```

### src/components/pdf-viewer-form-designer/pdf-viewer.component.ts

```typescript
import { Component, ViewChild } from '@angular/core';
import {
    AnnotationService,
    BookmarkViewService,
    FormDesignerService,
    FormFieldsService,
    LinkAnnotationService,
    MagnificationService,
    NavigationService,
    PageOrganizerService,
    PdfViewerComponent,
    PdfViewerModule,
    PrintService,
    TextSearchService,
    TextSelectionService,
    ThumbnailViewService,
    ToolbarService
} from '@syncfusion/ej2-angular-pdfviewer';
import { ChangeEventArgs, DropDownListModule } from '@syncfusion/ej2-angular-dropdowns';

type FormFieldType = Parameters<PdfViewerComponent['formDesigner']['addFormField']>[0];
type FormFieldModel = Parameters<PdfViewerComponent['formDesigner']['addFormField']>[1];

@Component({
    selector: 'control-content',
    templateUrl: 'pdf-viewer.component.html',
    providers: [
        LinkAnnotationService, BookmarkViewService, MagnificationService, ThumbnailViewService,
        ToolbarService, NavigationService, TextSearchService, TextSelectionService, PrintService,
        AnnotationService, FormFieldsService, FormDesignerService, PageOrganizerService
    ],
    standalone: true,
    imports: [PdfViewerModule, DropDownListModule]
})
export class FormDesignerComponent {
    @ViewChild('pdfviewer')
    public pdfviewerControl!: PdfViewerComponent;

    public readonly resource = 'https://cdn.syncfusion.com/ej2/35.1.37/dist/ej2-pdfviewer-lib';
    public readonly document = 'https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf';
    public readonly fieldTypes: { text: string; value: FormFieldType }[] = [
        { text: 'Textbox', value: 'Textbox' },
        { text: 'Password', value: 'Password' },
        { text: 'Checkbox', value: 'CheckBox' },
        { text: 'Radio button', value: 'RadioButton' },
        { text: 'Dropdown', value: 'DropDown' },
        { text: 'List box', value: 'ListBox' },
        { text: 'Signature', value: 'SignatureField' },
        { text: 'Initial', value: 'InitialField' },
        { text: 'Button', value: 'ButtonField' }
    ];
    public readonly fieldTypeFields = { text: 'text', value: 'value' };
    public fieldType: FormFieldType = 'Textbox';
    public isDocumentLoaded = false;
    private fieldNumber = 0;

    public onDocumentLoad(): void {
        this.isDocumentLoaded = true;
    }

    public onFieldTypeChange(event: ChangeEventArgs): void {
        if (typeof event.value === 'string') {
            this.fieldType = event.value as FormFieldType;
        }
    }

    public addFormField(): void {
        if (!this.isDocumentLoaded) {
            return;
        }

        const currentField = this.fieldNumber++;
        const settings: FormFieldModel = {
            name: `${this.fieldType}_${currentField + 1}`,
            pageNumber: this.pdfviewerControl.currentPageNumber,
            bounds: {
                X: 100 + (currentField % 2) * 240,
                Y: 120 + (Math.floor(currentField / 2) % 8) * 55,
                Width: 200,
                Height: 32
            },
            ...(this.fieldType === 'DropDown' || this.fieldType === 'ListBox'
                ? {
                    options: [
                        { itemName: 'Option 1', itemValue: 'Option 1' },
                        { itemName: 'Option 2', itemValue: 'Option 2' },
                        { itemName: 'Option 3', itemValue: 'Option 3' }
                    ]
                }
                : {})
        };
        this.pdfviewerControl.formDesigner.addFormField(this.fieldType, settings);
    }
}

```
