FormEditor Plugin

Overview

The Aspose.Pdf.LowCode.FormEditor plugin edits AcroForm fields in PDF documents. Use FormEditorAddOptions to add fields, FormEditorSetOptions to update fields, and remove options to delete fields.

Add a text field

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddTextFieldWithFormEditorPlugin()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();

    // Create PDF FormEditor plugin
    var plugin = new Aspose.Pdf.LowCode.FormEditor();

    // Configure a text field
    var fieldOptions = new Aspose.Pdf.LowCode.FormTextBoxFieldCreateOptions(
        1,
        new Aspose.Pdf.Rectangle(100, 600, 250, 625))
    {
        Name = "customerName",
        Value = "Customer name"
    };

    // Add input and output files
    var options = new Aspose.Pdf.LowCode.FormEditorAddOptions(
        new System.Collections.Generic.List<Aspose.Pdf.LowCode.FormFieldCreateOptions> { fieldOptions });
    options.AddInput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "TextField.pdf"));
    options.AddOutput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "AddTextFieldWithFormEditor_out.pdf"));

    // Add the field
    var result = plugin.Process(options);

    // Get the path of the saved PDF document
    var outputPath = result.ResultCollection[0].ToFile();
}

Options

Field creation options include public properties such as Name, Value, PartialName, AlternateName, ReadOnly, Required, and Exportable.