Documents for PDF .NET Edition
GrapeCity Documents PDF Viewer / Configure GcDocs PDF Viewer / Edit PDF / Form Editor
In This Topic
    Form Editor
    In This Topic

    The Form Editor in GcDocs PDF Viewer allows you to edit, design, fill and submit PDF forms. You can create new forms or modify existing ones by adding or removing different types of form fields and setting or modifying form field's properties like Name, ReadOnly, Max Length, Value, Bounds, Border etc. All the form fields of a form are listed in the Property panel so that any field can be accessed and modified at any point of time.

    The below image shows a PDF form in GcDocs PDF Viewer in which a text field is added using the Form Editor:

    Form Editor

    The different toolbar buttons in the Form Editor are described as below:

    Toolbar Icons Description
    Form field icon Selects a form field added on PDF
    Text field icon Adds a text field on PDF
    Password field icon Adds a password field on PDF
    Text area field icon Adds a text area field to add long text on PDF
    Checkbox icon Adds a check box on PDF
    Radio button icon Adds a radio button on PDF
    Push button icon Adds a push button on PDF
    Combo box icon Adds a combo box on PDF
    List icon Adds a list box on PDF
    comb-text field icon Adds a comb-text field to add text in equally spaced positions on PDF
    Submit button Adds a submit form button on PDF
    Reset button Adds a reset form button on PDF
    Delete button Deletes the form field

     

    Apart from the different types of form fields described above, GcDocs PDF Viewer also provides some general editing features while working with PDF documents. They are explained as below:

    Toolbar Icons Description
    Undo icon Undo changes
    Redo icon Redo changes
    Save icon Saves the modified document on client
    Blank doc icon Creates a new blank document
    Blank page icon Inserts a blank page
    Delete page icon Deletes current page
    Note: You can view, print or download the original PDF document at any point of time by using the 'Hide Annotations' button on the main toolbar.

    Property Panel of Form Editor

    When you click the Form Editor icon in the left vertical panel, the Property panel of the Form Editor becomes visible. The Property panel displays the list of all the form fields page-wise in your document.

    It also allows you to set or modify properties of any form field in the document like its text, border, location etc. For eg. The image below shows the properties of a text field in the Property panel.

     

    Property panel of form editor

     

    Enable Form Editor in GcDocs PDF Viewer

    The Form Editor is displayed by default in GcDocs PDF Viewer, by enabling the FormEditorPanel in the viewer using code:

    Index.cshtml
    Copy Code
    <script>
        var viewer = new GcPdfViewer("#host", { supportApi: 'SupportApi/GcPdfViewer' });
        viewer.addDefaultPanels();
        viewer.addFormEditorPanel();
        viewer.beforeUnloadConfirmation = true;
        viewer.open("Home/GetPdf");
    </script>
    

     

    To customize the form fields in GcDocs PDF Viewer, add the following lines of code in the class file where you load the PDF in the Viewer:

    C#
    Copy Code
    public static GcPdfViewerSupportApiDemo.Models.PdfViewerOptions PdfViewerOptions
            {
                get => new GcPdfViewerSupportApiDemo.Models.PdfViewerOptions(
                    GcPdfViewerSupportApiDemo.Models.PdfViewerOptions.Options.FormEditorPanel |
                    GcPdfViewerSupportApiDemo.Models.PdfViewerOptions.Options.ActivateFormEditor,
                    formEditorTools: new string[] { "edit-select-field", "$split", "edit-widget-tx-field", "edit-widget-tx-text-area", "$split", "edit-erase-field", "$split", "edit-undo", "edit-redo", "save" });
            }
    

    Create a PDF form using Form Editor

    Follow the below steps to create a 'Customer Detail' PDF form using the Form Editor in GcDocs PDF Viewer:

    1. Configure the GcDocs PDF Viewer for editing PDF documents and run the application.
    2. Load a PDF document containing static text corresponding to which you want to add form fields.
    3. Open the Form Editor using the last icon on the left vertical panel.
    4. Add text fields, text area and radio buttons to your form by using form editor tools.
    5. Set properties of form fields from the Property panel like location, border etc.
    6. Add a combo box which displays various drop down options when clicked (as shown below).
    7. Close the Form Editor and go back to View mode.

    A Customer Detail PDF form is created successfully. You can view the list of all the form fields in the property panel of Form Editor. 

    GcDocs PDF Viewer