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, pspdfkit.instance#save will save all changes to a PDF, including any forms that have been filled in. Afterward, you can use the pspdfkit.instance#exportPDF method to export the PDF with these changes:

PSPDFKit.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", (formFieldValues) => {
    instance.save();
    let pdf = instance.exportPDF();

    // The code to upload this PDF with the saved data goes here.
  });
});

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 guide.