Nutrient Web SDK
    Preparing search index...

    PDF action to run arbitrary JavaScript.

    It is an Immutable.Record and thus can be updated using set(key, value), for example: action.set("script", "alert(...)");.

    Create a new JavaScriptAction

    const action = new NutrientViewer.Actions.JavaScriptAction({
    script: "alert(...)"
    });

    Create a button to import a image using a JavaScriptAction

    const widget = new NutrientViewer.Annotations.WidgetAnnotation({
    id: NutrientViewer.generateInstantId(),
    pageIndex: 0,
    formFieldName: "buttonIcon",
    boundingBox: new NutrientViewer.Geometry.Rect({
    left: 100,
    top: 200,
    width: 100,
    height: 100
    }),
    action: new NutrientViewer.Actions.JavaScriptAction({
    script: "event.target.buttonImportIcon()"
    }),
    borderWidth: 0
    });
    const formField = new NutrientViewer.FormFields.ButtonFormField({
    name: "buttonIcon",
    annotationIds: NutrientViewer.Immutable.List([widget.id])
    });
    await instance.create([widget, formField]);

    Hierarchy

    Index

    Constructors

    Properties

    script: string

    The JavaScript to run.

    Actions can be chained by adding them to this immutable List.

    Methods

    • Type Parameters

      • K extends "subActions"

      Parameters

      • key: K

      Returns this

    • Parameters

      • other: unknown

      Returns boolean

    • Parameters

      • keyPath: Iterable<unknown>
      • OptionalnotSetValue: unknown

      Returns unknown

    • Parameters

      • key: unknown

      Returns boolean

    • Parameters

      Returns this

    • Parameters

      Returns this

    • Parameters

      • keyPath: Iterable<unknown>
      • value: unknown

      Returns this

    • Returns Keyed<string, unknown>

    • Parameters

      • keyPath: Iterable<unknown>
      • notSetValue: unknown
      • updater: (value: unknown) => unknown

      Returns this

    • Parameters

      • keyPath: Iterable<unknown>
      • updater: (value: unknown) => unknown

      Returns this

    • Parameters

      • mutator: (mutable: this) => unknown

      Returns this