# pdf-viewer-form-designer

> PDF viewer sample adding interactive form fields programmatically with selectable field types and dropdown options.

**Framework:** vue  **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/vue/pdf-viewer-form-designer.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-pdfviewer @syncfusion/ej2-vue-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/PdfViewer.vue

```vue
<template>
  <div class="control-section form-designer">
    <div class="controls">
      <label for="field-type">Form field type</label>
      <ejs-dropdownlist id="field-type" ref="fieldType" :dataSource="fieldTypes" :fields="{ text: 'text', value: 'value' }" value="Textbox" />
      <button class="e-btn e-primary" type="button" :disabled="!isDocumentLoaded" @click="addField">Add form field</button>
    </div>
    <ejs-pdfviewer id="pdfviewer" ref="pdfviewer" :documentPath="documentPath" :resourceUrl="resourceUrl" :documentLoad="documentLoad" />
  </div>
</template>

<script lang="ts">
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns';
import {
  PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView,
  ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer
} from '@syncfusion/ej2-vue-pdfviewer';

export default {
  components: { 'ejs-pdfviewer': PdfViewerComponent, 'ejs-dropdownlist': DropDownListComponent },
  data() {
    return {
      documentPath: 'https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf',
      resourceUrl: 'https://cdn.syncfusion.com/ej2/35.1.37/dist/ej2-pdfviewer-lib',
      fieldNumber: 0,
      isDocumentLoaded: false,
      fieldTypes: [
        { 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' }
      ]
    };
  },
  provide: {
    PdfViewer: [Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer]
  },
  methods: {
    documentLoad() {
      this.isDocumentLoaded = true;
    },
    addField() {
      const viewer = (this.$refs.pdfviewer as any).ej2Instances;
      const fieldType = (this.$refs.fieldType as any).ej2Instances;
      if (!viewer || !fieldType) {
        return;
      }
      const type = fieldType.value;
      const row = this.fieldNumber++ % 6;
      viewer.formDesigner.addFormField(type, {
        name: `${type}_${this.fieldNumber}`, pageNumber: 1,
        bounds: { X: 100, Y: 120 + row * 55, Width: 220, Height: 32 },
        options: type === 'DropDown'
          ? [{ itemName: 'Option 1', itemValue: 'Option 1' }, { itemName: 'Option 2', itemValue: 'Option 2' }]
          : undefined
      });
    }
  }
};
</script>

<style scoped>
.controls { display: flex; align-items: end; gap: 12px; padding: 8px 0 12px; }
.controls label { font-weight: 600; }
#field-type { width: 180px; }
#pdfviewer { height: 640px; }
</style>

```
