The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

Delete Interactive Forms

  • 3 min to read

You can remove an interactive form field or a whole interactive form from a PDF document.

Remove a Form Field

Call the PdfDocumentProcessor.GetFormFieldNames method to obtain names of interactive form fields.

Call the PdfDocumentProcessor.RemoveFormField method and with passed field name to remove a desired field. This method tries to find the field in a document using the field name. If it finds this field, the method removes it from the document and returns true; otherwise, it returns false.

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T494240.


using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {

    // Load a document with an interactive form.
    processor.LoadDocument("..\\..\\InteractiveForm.pdf");

    // Remove a form field by its name.
    if (processor.RemoveFormField("FirstName"))

        // Save the modified document.
        processor.SaveDocument("..\\..\\Result.pdf");

    else

        // Shows a message if the form field is not found in a document.
        Console.WriteLine("The form field was not removed from a document. Make sure, the form field exists in the document.");
}

Remove an Interactive Form

Call the PdfDocumentProcessor.RemoveForm method to remove all form fields from a document. If the interactive form is successfully removed, this method returns true. If the document does not contain an interactive form that should be removed, it returns false.

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T494240.


using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {

    // Load a document with an interactive form.
    processor.LoadDocument("..\\..\\InteractiveForm.pdf");

    // Remove the whole interactive form.
    if (processor.RemoveForm())

        // Save the modified document.
        processor.SaveDocument("..\\..\\Result.pdf");

    else

        // Shows a message if the interactive form is not found in a document.
        Console.WriteLine("The interactive form was not removed from a document. Make sure the interactive form exists in the document.");
}