---
title: "Embed data into PDF form using JavaScript | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/web/forms/submit-or-save/embed-data-into-pdf/"
md_url: "https://www.nutrient.io/guides/web/forms/submit-or-save/embed-data-into-pdf.md"
last_updated: "2026-05-25T06:31:34.579Z"
description: "Nutrient Web SDK lets you save the data your customer fills your PDF forms with so that the forms can be loaded later."
---

# Embed data into PDF forms using JavaScript

Nutrient Web SDK allows you to save the data your customer fills your PDF forms with so that the forms can be loaded later.

Out of the box, [`nutrientviewer.instance#save`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#save) will save all changes to a PDF, including any forms that have

been filled in. Afterward, you can use the [`nutrientviewer.instance#exportPDF`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#exportPDF) method to export the PDF with

these changes:

```js

// Standalone mode: saves and exports PDF on form field changes
NutrientViewer.load({
  document: document
}).then((instance) => {
  // Every time a user makes a change, save the document to create a snapshot that can be
  // uploaded somewhere.
  //
  instance.addEventListener("formFieldValues.update", async (formFieldValues) => {
    try {
      await instance.save();
      const pdf = await instance.exportPDF();

      // The code to upload this PDF with the saved data goes here.
    } catch (error) {
      console.error("Failed to save or export PDF:", error);
    }
  });
});

```

**Performance tip:** When saving on every form field update as shown above, consider implementing debouncing or throttling to avoid excessive save operations, especially for forms with many fields or when network latency is a concern. A typical debounce delay of 500-1000ms works well for most use cases.

## Autosaving

Nutrient Web SDK can handle automatically saving after each change so that a PDF is ready to be exported.

You can read more about this in the [autosaving](https://www.nutrient.io/guides/web/annotations/annotation-saving-mechanism.md) guide.
---

## Related pages

- [Autosaving changes made to PDF forms](/guides/web/forms/submit-or-save/auto-save.md)
- [Submit and save PDF forms using Document Engine](/guides/web/forms/submit-or-save/to-server-backed.md)
- [Submit and save PDF forms to an external source](/guides/web/forms/form-submission.md)

