Paper Form Data Extraction
SurveyJS provides an MIT-licensed plugin—AI Form Response Extractor—that helps extract structured data from completed paper forms, scanned documents, and digital PDFs using AI. Given a filled-out form (as an image or PDF) and a SurveyJS JSON schema, the tool automatically maps detected values into the corresponding fields. This demo showcases the workflow in action: select and configure an LLM, upload a scanned image or PDF, and provide a JSON schema. The model then returns extracted answers aligned with that schema, which are rendered in a regular SurveyJS form for review and correction before submission.
Configure an LLM Provider
Data extraction is powered by an LLM of your choice. In this demo, you can switch between OpenAI and Anthropic. API keys are preconfigured for demonstration purposes; however, when integrating into your own application, you must supply your own keys via environment variables.
Provide a Form JSON Schema
The schema defines the target structure for extracted data. Each question's name becomes a key in the resulting data object, while the title provides a human-readable cue to help the model interpret the form.
Additionally, both individual fields and the form itself can include an aiHint property, which gives the model extra context about the expected content. This property is used only by the AI and is not visible in the rendered form.
{
"aiHint": "This form contains basic personal identification fields including full name, date of birth, and contact email.",
"elements": [
{
"type": "text",
"name": "fullName",
"title": "Full name",
"aiHint": "Person's full legal name. May appear as a single line or split into first/middle/last name. Preserve original order and capitalization."
},
{
"type": "text",
"name": "dateOfBirth",
"title": "Date of birth",
"inputType": "date",
"aiHint": "Person's date of birth. Look for common formats such as DD/MM/YYYY, MM/DD/YYYY, or YYYY-MM-DD. Normalize only if explicitly required by output schema."
},
{
"type": "text",
"name": "email",
"title": "Email address",
"inputType": "email",
"aiHint": "Contact email address. Must include '@' and domain. Extract exactly as shown without modification or validation correction."
}
]
}
Review the Extracted Data
The extracted output is returned as a plain JavaScript object whose keys correspond to the question name values in the schema. To display the results in an editable SurveyJS form, assign this object to the SurveyModel's data property:
import { Model } from "survey-core";
const survey = new Model(surveyJson);
survey.data = extractedData;
Because the result is rendered as a standard SurveyJS survey, you automatically get built-in validation, conditional logic, and theming. Users can correct any misread or incomplete fields before final submission.
For more implementation details and source code, see the following GitHub repository:
AI Form Response Extractor Demo
See Also
Paper form extraction is part of a broader workflow that unifies data collection across paper and digital channels. For more context, see the following help topic: