ComPDFKit Web SDK
    Preparing search index...

    Class FormFieldCreationManager

    Base class for objects that fire named events. Listener arguments are passed by position.

    Hierarchy (View Summary)

    • EventHandler<FormFieldCreationManagerEvents>
      • FormFieldCreationManager
    Index
    • Adds a listener for an event. Adding the same function twice for one event has no effect.

      Type Parameters

      • K extends keyof FormFieldCreationManagerEvents

      Parameters

      • name: K

        Event name.

      • fn: (...args: FormFieldCreationManagerEvents[K]) => void

        Listener, called with the event arguments.

      • Optionaloptions: { once?: boolean }

        Listener options.

        • Optionalonce?: boolean

          When true, the listener is removed after it runs once.

      Returns void

    • Allows tools to be used in form field creation mode.

      Parameters

      • names: string[]

        Tool names to allow.

      Returns void

    • Turns off adding form fields with a single click (the default); fields are drawn by dragging.

      Returns void

    • Hides markup annotations while in form field creation mode.

      Returns void

    • Disallows tools in form field creation mode.

      Parameters

      • names: string[]

        Tool names to disallow.

      Returns void

    • Switch for adding form fields with a click (off by default: a click adds nothing, only dragging out a box does). When on, a click adds one at the default size, which can be changed per tool (setClickCreateSize).

      Returns void

    • Also shows other annotations in creation mode (shown by default, just not selectable or editable; call disable to hide them).

      Returns void

    • Does not end while some fields have no name; fires formFieldCreationEmptyFieldNames.

      Returns Promise<void>

    • Default size of a form field tool when adding with a click: the changed size if changed, otherwise the tool's own default; undefined when not a form field tool.

      Parameters

      • toolName: string

      Returns [number, number] | undefined

    • Gets the indicator text of a widget in form field creation mode.

      Parameters

      Returns string

      The indicator text.

    • Field name of the radio group.

      Returns string[]

    • Whether the indicator is shown for a widget in form field creation mode.

      Parameters

      Returns boolean

      True when the indicator is shown.

    • Whether form fields can be added with a single click.

      Returns boolean

      True when click-to-create is on.

    • Whether form field creation mode is on.

      Returns boolean

      True in form field creation mode.

    • Whether markup annotations are shown in form field creation mode.

      Returns boolean

      True when shown (the default).

    • Whether a tool can be used in form field creation mode.

      Parameters

      • name: string

        The tool name.

      Returns boolean

      True when the tool is allowed.

    • Removes a listener, or every listener of the event when fn is omitted.

      Type Parameters

      • K extends keyof FormFieldCreationManagerEvents

      Parameters

      • name: K

        Event name.

      • Optionalfn: (...args: FormFieldCreationManagerEvents[K]) => void

        The function that was passed to addEventListener.

      Returns void

    • Changes the default size (pt) of a form field tool (such as TextFormFieldCreateTool) when adding with a click.

      Parameters

      • toolName: string
      • size: [number, number]

      Returns void

    • Changes a widget's field name and commits; returns whether the name is usable: empty after trimming is empty (still set, used to clear); a name used by another field is duplicate (not changed), except that radio buttons may join a radio group of the same name, but not a non-radio field with that name. For non-radio widgets the whole field is renamed (all widgets of the field together).

      Parameters

      Returns { errorType: "empty" | "duplicate" | null; isValid: boolean }

      • errorType: "empty" | "duplicate" | null

        Why the name was not accepted, or null when it was.

      • isValid: boolean

        Whether the name was accepted.

    • Sets the indicator text of a widget in form field creation mode (for radio buttons, the whole group) and commits.

      Parameters

      Returns void

    • Shows or hides the indicator of a widget in form field creation mode (for radio buttons, the whole group) and commits.

      Parameters

      • annotation: WidgetAnnotation

        The widget.

      • show: boolean

        Whether to show the indicator.

      Returns void

    • Enters form field creation mode: widgets become editable as annotations instead of fillable fields. Fires formFieldCreationModeStarted; does nothing if already in the mode.

      Returns void

    • A listener that throws does not affect the others; the error is reported through logger.error.

      Type Parameters

      • K extends keyof FormFieldCreationManagerEvents

      Parameters

      • name: K
      • Optionalargs: FormFieldCreationManagerEvents[K]

      Returns void

    • Like trigger, but awaits the Promise returned by each listener in turn; a failing listener does not affect the others.

      Type Parameters

      • K extends keyof FormFieldCreationManagerEvents

      Parameters

      • name: K
      • Optionalargs: FormFieldCreationManagerEvents[K]

      Returns Promise<void>

    Events: {
        FORM_CREATION_EMPTY_FIELD_NAMES: "formFieldCreationEmptyFieldNames";
        FORM_CREATION_ENDED: "formFieldCreationModeEnded";
        FORM_CREATION_STARTED: "formFieldCreationModeStarted";
    }

    Event names of the form field creation manager.

    Type Declaration

    • ReadonlyFORM_CREATION_EMPTY_FIELD_NAMES: "formFieldCreationEmptyFieldNames"

      'formFieldCreationEmptyFieldNames': form field creation mode could not end because some fields have no name.

    • ReadonlyFORM_CREATION_ENDED: "formFieldCreationModeEnded"

      'formFieldCreationModeEnded': form field creation mode was left.

    • ReadonlyFORM_CREATION_STARTED: "formFieldCreationModeStarted"

      'formFieldCreationModeStarted': form field creation mode was entered.