Form Fields removed after saving document

Hi team.
We have faced with the following problem:
There is a *.pdf file with form fileds inside. After opening and resaving it without any changes and activities form fileds are removed. Pay attention that file need to be opened with Acrobal reader.
We use the latest version of Aspose.PDF 25.10.0.
Archive with code sample and file is attached.
Internal ticket: CLN-2947
image.png (6.6 KB)
=>
image.png (6.3 KB)

FormFields.zip (35.9 KB)

@VadymIanchenko

Summary
When a PDF that contains fillable form fields is opened and saved with Aspose.PDF using the default settings, the library flattens the form. The interactive fields are converted to static page content, so the fields disappear when the resulting file is opened in Acrobat Reader.

Why it happens

  • Default flatteningDocument.FormFlattening is true by default, which causes the form to be flattened on save.
  • Save options – The default PdfSaveOptions do not explicitly preserve the AcroForm entries, so they are omitted from the saved file.
  • XFA forms – If the source PDF uses XFA forms, Aspose.PDF’s support is limited; such forms may also be lost unless handled specially.

What to do next

  1. Turn off form flattening before saving.
  2. Tell the saver to keep the form fields by setting PreserveFormFields in PdfSaveOptions.
  3. Handle XFA‑based PDFs separately if they are part of your workflow.
using Aspose.Pdf;
using Aspose.Pdf.SaveOptions;

class Program
{
 static void Main()
 {
 // Load the PDF that contains fillable fields
 Document pdf = new Document("FormFields.pdf");

 // 1️⃣ Keep the form interactive – do not flatten it
 pdf.FormFlattening = false;

 // 2️⃣ Save with options that preserve the form
 PdfSaveOptions saveOpts = new PdfSaveOptions
 {
 PreserveFormFields = true // ensures the AcroForm is written back
 };

 // 3️⃣ Save the document (to file or stream)
 pdf.Save("FormFields_Saved.pdf", saveOpts);
 }
}

Additional checks

Item What to verify
AcroForm vs. XFA If the original PDF uses XFA, consider converting it to an AcroForm‑based PDF (e.g., with Adobe Acrobat) before processing, or use the XfaForm API to extract data without flattening.
Library version The code follows the public API and should work with recent Aspose.PDF .NET releases (e.g., 25.x and later).
Alternative output When saving to a MemoryStream, pass the same PdfSaveOptions to pdf.Save(stream, saveOpts);.

Next steps for you

  1. Modify your existing code to set pdf.FormFlattening = false and to use PdfSaveOptions.PreserveFormFields = true.
  2. Run the updated code and open the resulting PDF in Acrobat Reader to confirm that the fillable fields are still present.
  3. If the source PDFs contain XFA forms and the fields still disappear, convert those PDFs to AcroForm format first, or extract the needed data via the XfaForm API before saving.

If the problem remains after these changes, please provide the exact code snippet you are using (and a sample PDF, if possible) so the issue can be examined further.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

not relevant answer