---
title: Employee Information Form
product: PDF Generator
description: Get a printable employee information form in PDF. Create editable or prefilled employee data collection forms using SurveyJS PDF Generator.
framework: Vanilla JS
source: https://surveyjs.io/pdf-generator/examples/pdf-hr-employee-information-form/vanillajs
index: https://surveyjs.io/pdf-generator/examples/overview.md
---

# Employee Information Form (Vanilla JS)

## Files

### `public/index.html`

```html
<div style="display: flex;">
    <div id="surveyElement" style="flex: 1 1 0%; height: 100%; min-width: 0;"></div>
    <div id="pdf-preview" style="flex: 0.7 0.7 0%; display: none">
        <embed id="pdf-preview-frame" type="application/pdf" style="width:100%; height:100%;" />
    </div>
</div>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import { Model } from "survey-core";
import "survey-js-ui";
import { SurveyPDF } from "survey-pdf";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";

function createSurveyPdfModel (surveyModel) {
    const surveyPDF = new SurveyPDF(json);
    if (surveyModel) {
        surveyPDF.data = surveyModel.data;
        surveyPDF.locale = surveyModel.locale;
        
        
    }
    
    return surveyPDF;
}
function saveSurveyToPdf (filename, surveyModel) {
    const pdfDoc = createSurveyPdfModel(surveyModel);
    if (!pdfDoc) return;

    pdfDoc.save(filename);
}

const previewDiv = document.getElementById("pdf-preview");
const previewEmbed = document.getElementById("pdf-preview-frame");
let pdfBlobUrl;

function showPdfPreview(surveyModel) {
    if (!previewDiv || !previewEmbed) return;

    const pdfDoc = createSurveyPdfModel(surveyModel);
    if (!pdfDoc) return;

    pdfDoc.raw("blob").then((blob) => {
        if (pdfBlobUrl) {
            URL.revokeObjectURL(pdfBlobUrl);
        }
        pdfBlobUrl = URL.createObjectURL(blob);
        previewEmbed.setAttribute("src", pdfBlobUrl);
        previewDiv.style.display = "block";
    });
}

function previewPdf(surveyModel) {
    if (!previewDiv) return;

    if (previewDiv.style.display !== "none") {
        previewDiv.style.display = "none";
        return;
    }

    showPdfPreview(surveyModel);
}

const survey = new Model(json);
survey.showCompleteButton = false;
survey.navigationButtonsLocation = "topBottom";
survey.addNavigationItem({
    id: "survey_save_as_file",
    title: "Download PDF",
    action: () => {
        saveSurveyToPdf("surveyResult.pdf", survey);
    }
});
survey.addNavigationItem({
    id: "survey_pdf_preview",
    title: "Preview PDF",
    visible: window.navigator.pdfViewerEnabled,
    action: () => {
        previewPdf(survey);
    }
});
survey.render(document.getElementById("surveyElement"));
```

### `src/json.js`

```js
export const json = {
  "title": "Employee Information Form",
  "pages": [
    {
      "name": "personal-information",
      "title": "Personal Information",
      "elements": [
        {
          "type": "text",
          "name": "firstName",
          "title": "First Name",
          "isRequired": true
        },
        {
          "type": "text",
          "name": "lastName",
          "title": "Last Name",
          "isRequired": true,
          "startWithNewLine": false
        },
        {
          "type": "radiogroup",
          "name": "gender",
          "title": "Gender",
          "choices": [
            "Male",
            "Female",
            "Non-binary",
            "Prefer not to say"
          ],
          "colCount": 2
        },
        {
          "type": "text",
          "name": "dateOfBirth",
          "title": "Date of Birth (MM/DD/YYYY)"
        },
        {
          "type": "text",
          "name": "employeeId",
          "title": "Employee ID (if applicable)",
          "startWithNewLine": false
        }
      ]
    },
    {
      "name": "contact-information",
      "title": "Contact Information",
      "elements": [
        {
          "type": "text",
          "name": "email",
          "title": "Email Address",
          "inputType": "email",
          "isRequired": true
        },
        {
          "type": "text",
          "name": "phone",
          "title": "Phone Number",
          "startWithNewLine": false
        },
        {
          "type": "text",
          "name": "address",
          "title": "Home Address"
        }
      ]
    },
    {
      "name": "job-details",
      "title": "Job Details",
      "elements": [
        {
          "type": "radiogroup",
          "name": "employmentType",
          "title": "Employment Type",
          "choices": [
            "Full-time",
            "Part-time",
            "Contract",
            "Intern"
          ],
          "colCount": 2
        },
        {
          "type": "text",
          "name": "department",
          "title": "Department"
        },
        {
          "type": "text",
          "name": "jobTitle",
          "title": "Job Title",
          "startWithNewLine": false
        },
        {
          "type": "text",
          "name": "managerName",
          "title": "Manager / Supervisor Name (if applicable)"
        }
      ]
    },
    {
      "name": "skills-certifications",
      "title": "Skills & Certifications",
      "elements": [
        {
          "type": "checkbox",
          "name": "skills",
          "title": "Skills",
          "description": "Check all that apply.",
          "choices": [
            "Project Management",
            "Software Development",
            "Data Analysis",
            "Design",
            "Customer Service",
            "Other (please specify)"
          ],
          "colCount": 2
        },
        {
          "type": "checkbox",
          "name": "certifications",
          "title": "Certifications",
          "description": "Check all that apply.",
          "choices": [
            "PMP",
            "AWS Certified",
            "Scrum Master",
            "First Aid",
            "Other (please specify)"
          ],
          "colCount": 2
        }
      ]
    },
    {
      "name": "emergency-contacts",
      "title": "Emergency Contacts",
      "elements": [
        {
          "type": "paneldynamic",
          "name": "emergencyContacts",
          "title": "Emergency Contact Information",
          "templateTitle": "Contact #{panelIndex}",
          "panelCount": 3,
          "panelsState": "firstExpanded",
          "templateElements": [
            {
              "type": "text",
              "name": "contactName",
              "title": "Full Name"
            },
            {
              "type": "text",
              "name": "relationship",
              "title": "Relationship",
              "startWithNewLine": false
            },
            {
              "type": "text",
              "name": "contactPhone",
              "title": "Phone Number",
              "startWithNewLine": false
            }
          ]
        }
      ]
    },
    {
      "name": "additional-information",
      "elements": [
        {
          "type": "checkbox",
          "name": "additionalInfo",
          "title": "Additional Information",
          "description": "Check all that apply.",
          "choices": [
            "Has previous work experience (if yes, describe below)",
            "Requires special accommodations",
            "Other relevant information"
          ],
          "showCommentArea": true,
          "commentText": ""
        },
        {
          "type": "text",
          "name": "additionalDetails",
          "title": "Details / Comments (if applicable)",
          "rows": 4
        }
      ]
    }
  ],
  "questionsOnPageMode": "singlePage",
  "headerView": "advanced"
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

```json
{
  "dependencies": {
    "survey-core": "latest",
    "survey-js-ui": "latest",
    "survey-pdf": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/pdf-generator/examples/pdf-hr-employee-information-form/angular.md)
- [React](https://surveyjs.io/pdf-generator/examples/pdf-hr-employee-information-form/reactjs.md)
- [Vue 3](https://surveyjs.io/pdf-generator/examples/pdf-hr-employee-information-form/vue3js.md)
- [jQuery](https://surveyjs.io/pdf-generator/examples/pdf-hr-employee-information-form/jquery.md)
