---
title: "React PDF form library: Create, fill, and extract data in your web app | Nutrient Web SDK"
canonical_url: "https://www.nutrient.io/guides/web/forms/react/"
md_url: "https://www.nutrient.io/guides/web/forms/react.md"
last_updated: "2026-11-11T00:00:00.000Z"
description: "Learn how to create, fill, and extract data from a PDF form using Nutrient Web SDK. Build interactive PDF forms in React with a user-friendly UI and robust APIs."
---

# React PDF form library

Nutrient Web SDK is a JavaScript library for filling, reading, creating, and editing PDF AcroForms. It’s fully compatible with React and offers developers an API for programmatic access to PDF form objects, as well as a beautiful user interface (UI) for form filling in any React-based web app.

[Launch demo](https://www.nutrient.io/demo/forms)

## Key capabilities

- **User friendly interface** — Fill forms easily with a prebuilt UI

- **Programmatic access** — Read, write, and modify PDF form data

- **Database integration** — Import/export form data seamlessly

- **Signatures** — Add electronic signature fields

- **Custom permissions** — Control user interactions with form fields

- **High-performance rendering** — Ensure smooth form handling in React-based web applications

## Build and manage PDF forms in React

PDF forms allow users to input data digitally, replacing traditional paper forms. With Nutrient Web SDK, developers can seamlessly integrate PDF form functionality into React-based web applications, enabling form creation, filling, data extraction, and more.

This guide provides a comprehensive tutorial for working with React-based PDF forms, including code examples and best practices.

## What are PDF forms?

PDF forms are interactive documents that allow users to enter data. Unlike static PDFs, these forms include fillable fields such as text boxes, checkboxes, dropdowns, and signature fields. For more information, see [understanding the benefits of PDF forms](https://www.nutrient.io/guides/web/forms/introduction-to-forms/what-are-forms.md).

## Supported PDF form fields

Nutrient Web SDK supports various PDF form fields, including:

- Text fields (for entering text)

- Checkboxes (for multiple-choice selections)

- Radio buttons (for selecting one option)

- Push buttons (for triggering an action when clicked)

- List boxes (for choosing multiple options from a predefined list)

- Combo boxes (for choosing a single option from a predefined list)

- Signature fields (for signing PDFs)

For more information, see [supported PDF form fields](https://www.nutrient.io/guides/web/forms/introduction-to-forms.md).

## Supported data formats

PDF forms can store and retrieve data in multiple formats, including:

- XFDF (XML forms data format)

- JSON (for web applications)

For more information, see [PDF form elements and data formats](https://www.nutrient.io/guides/web/forms/introduction-to-forms/data-formats.md).

## Fill PDF forms programmatically

Nutrient Web SDK offers multiple options for filling form fields programmatically, each with a different set of tradeoffs.

- **Using Web SDK with Document Engine** — For persisting, restoring, and synchronizing the form field values across multiple devices without needing to build it yourself.

- **XFDF** — For exporting to or importing from other readers.

- **Instant JSON** — For the most efficient way to export or import changes made.

- **Manual API** — For complete control over extracting and saving the values of the forms.

For example, when using Web SDK with Document Engine, when a [document is opened from Document Engine](https://www.nutrient.io/guides/web/open-a-document/from-document-engine.md), the latest form field values are immediately loaded.

```js
NutrientViewer.load({
  container: "#pspdfkit",
  documentId: "DOCUMENT_ID_GOES_HERE",
  authPayload: { jwt: "YOUR_JWT_GOES_HERE" },
  instant: true // Sync changes between users who have same document open.
  // ...
});
```

For more information, see [fill PDF forms programmatically](https://www.nutrient.io/guides/web/forms/form-filling.md).

## Flatten PDF forms

Flattening a form ensures users can no longer edit the fields:

```js
const content = await instance.exportPDF({ flatten: true });
console.log(content); // => ArrayBuffer of document with flattened form fields
```

For more information, see [flatten dynamic PDF forms](https://www.nutrient.io/guides/web/forms/flatten.md).

## Add a signature field to a PDF form

You can add a signature form field, which can then be used as a placeholder for [electronic signatures](https://www.nutrient.io/guides/web/signatures/overview.md#electronic-signatures):

```js
const widget = new NutrientViewer.Annotations.WidgetAnnotation({
  id: NutrientViewer.generateInstantId(),
  pageIndex: 0,
  boundingBox: new NutrientViewer.Geometry.Rect({
    left: 200,
    top: 300,
    width: 150,
    height: 75
  }),
  formFieldName: "my signature form field"
});
const formField = new NutrientViewer.FormFields.SignatureFormField({
  name: "my signature form field",
  annotationIds: new NutrientViewer.Immutable.List([widget.id])
});
await instance.create([widget, formField]);
```

For more information, see [adding a signature field to a PDF form](https://www.nutrient.io/guides/web/forms/create-edit-and-remove/add-signature-field.md).

## Import data into PDF forms from a database

You can populate forms with external data sources such as databases. For example, assume your backend application exposes a `/profile` endpoint that returns the current user’s profile information, including the first name and the last name.

If you want to prefill the first name and the last name in the document the user opens, insert the form field values into the [Instant JSON](https://www.nutrient.io/guides/web/json.md) object and import it when the document is opened:

```js
// This loads the profile information from your server which, in turn, imports it from the database.
const profileResponse = await fetch(
  "https://your-server.example.com/profile"
);
const { firstName, lastName } = await profileResponse.json();
// Insert the form field values into Instant JSON.
const instantJSON = {
  format: "https://pspdfkit.com/instant-json/v1",
  formFieldValues: [
    {
      v: 1,
      type: "pspdfkit/form-field-value",
      name: "firstNameField",
      value: firstName
    },
    {
      v: 1,
      type: "pspdfkit/form-field-value",
      name: "lastNameField",
      value: lastName
    }
  ]
};
// Open a document and immediately import Instant JSON into it.
const instance = await NutrientViewer.load({
  instantJSON: instantJSON /* required options */
});
```

For more information, see [import data into PDFs from a database](https://www.nutrient.io/guides/web/forms/fill-form-fields/import-from-database.md).

## Fill PDF form fields using the built-in UI

Nutrient Web SDK provides a form filling UI out of the box. With the **Form Creator** component in your license, form design mode also lets users select, move, and resize form fields:

```js
instance.setViewState((viewState) =>
  viewState.set("formDesignMode", true)
);
```

For more information, see [fill PDF form fields using viewer UI](https://www.nutrient.io/guides/web/forms/fill-form-fields/using-the-ui.md).

## Extract data from PDF form fields

You can extract form data in Instant JSON or other formats:

```js
const instantJSON = await instance.exportInstantJSON();

const formFieldValues = instantJSON.formFieldValues;
console.log(formFieldValues); // [{"name":"Form Field","type":"pspdfkit/form-field-value","v":1}]
```

For more information, see [extract data from PDF form fields](https://www.nutrient.io/guides/web/forms/extract-form-data.md).

## Read PDF form fields

Retrieve form field names, types, and values programmatically:

```js
const formFields = await instance.getFormFields();
console.log(formFields.size);
```

For more information, see [read PDF form fields using JavaScript](https://www.nutrient.io/guides/web/forms/read-form-fields.md).

## Additional PDF form functionalities

- [**Attach files to PDF forms**](https://www.nutrient.io/guides/web/forms/fill-form-fields/attach-a-file.md) — Learn how to attach a file to a PDF as an image annotation

- [**Add images to PDF forms**](https://www.nutrient.io/guides/web/forms/fill-form-fields/add-image.md) — Discover how to add an image to a PDF as an image annotation

- [**Detect user input in PDF forms**](https://www.nutrient.io/guides/web/forms/fill-form-fields/detect-user-input.md) — Learn how to subscribe to form events to detect form field input

- [**Customize PDF form permissions**](https://www.nutrient.io/guides/web/forms/fill-form-fields/permissions.md) — Learn how to control user interactions with form fields

- [**Dynamic font loading in PDF forms**](https://www.nutrient.io/guides/web/forms/fill-form-fields/dynamic-font-loading.md) — Discover how to dynamically load fonts when users enter text containing characters not supported by available fonts

## FAQ

#### What is Nutrient Web SDK?

Nutrient Web SDK is a powerful JavaScript library that enables developers to fill, create, and edit PDF AcroForms in web applications.

#### How can forms be filled using Nutrient Web SDK?

Forms in PDF documents can be filled programmatically using APIs or interactively through Nutrient Web SDK’s intuitive UI.

#### Can I create PDF forms from scratch with Nutrient Web SDK?

Yes, Nutrient Web SDK allows you to create fillable PDF forms and fields from scratch using developer APIs or the drag-and-drop form creator tool.

#### Can I customize the appearance of form fields in Nutrient Web SDK?

Absolutely! Nutrient Web SDK offers styling options to customize the appearance of form fields, including colors, borders, backgrounds, and widths.

#### Does Nutrient Web SDK support form validation?

Yes, Nutrient Web SDK supports JavaScript-based form validation to ensure the accuracy and reliability of form field inputs.

**Call to Action**

Start your free trial for unlimited access and expert support.

[Learn More](https://www.nutrient.io/sdk/web/getting-started/react-vite.md)
---

## Related pages

- [JavaScript PDF fillable form library](/guides/web/forms.md)
- [Angular PDF form library](/guides/web/forms/angular.md)
- [ASP.NET PDF form library](/guides/web/forms/aspnet.md)
- [Blazor PDF form library](/guides/web/forms/blazor.md)
- [Choose the right forms workflow setup](/guides/web/forms/choose-the-right-forms-workflow-setup.md)
- [Extract data from PDF form fields using JavaScript](/guides/web/forms/extract-form-data.md)
- [Flatten dynamic PDF forms using JavaScript](/guides/web/forms/flatten.md)
- [HTML5 PDF form library](/guides/web/forms/html5.md)
- [Validate PDF forms using JavaScript](/guides/web/forms/javascript-validation.md)
- [jQuery PDF form library](/guides/web/forms/jquery.md)
- [Laravel PDF form library](/guides/web/forms/laravel.md)
- [Next.js PDF form library](/guides/web/forms/nextjs.md)
- [Nuxt.js PDF form library](/guides/web/forms/nuxtjs.md)
- [Master PDF actions with JavaScript integration](/guides/web/forms/pdf-actions-support.md)
- [PHP PDF form library](/guides/web/forms/php.md)
- [Read PDF form fields using JavaScript](/guides/web/forms/read-form-fields.md)
- [Svelte PDF form library](/guides/web/forms/svelte.md)
- [TypeScript PDF form library](/guides/web/forms/typescript.md)
- [Vue.js PDF form library](/guides/web/forms/vuejs.md)

