Nutrient Web SDK
    Preparing search index...

    Type Alias MeasurementValueConfigurationCallback

    MeasurementValueConfigurationCallback: (
        configuration: {
            name?: string;
            precision:
                | "whole"
                | "oneDp"
                | "twoDp"
                | "threeDp"
                | "fourDp"
                | "1/2"
                | "1/4"
                | "1/8"
                | "1/16";
            scale: {
                fromValue: number;
                toValue: number;
                unitFrom: "in"
                | "mm"
                | "cm"
                | "pt";
                unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
            };
            selected?: boolean;
        }[],
    ) => {
        name?: string;
        precision: | "whole"
        | "oneDp"
        | "twoDp"
        | "threeDp"
        | "fourDp"
        | "1/2"
        | "1/4"
        | "1/8"
        | "1/16";
        scale: {
            fromValue: number;
            toValue: number;
            unitFrom: "in"
            | "mm"
            | "cm"
            | "pt";
            unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
        };
        selected?: boolean;
    }[]

    Nutrient Web SDK allows you to pass a customized configuration for measurements annotation scale and precision through the following callback

    Type Declaration

      • (
            configuration: {
                name?: string;
                precision:
                    | "whole"
                    | "oneDp"
                    | "twoDp"
                    | "threeDp"
                    | "fourDp"
                    | "1/2"
                    | "1/4"
                    | "1/8"
                    | "1/16";
                scale: {
                    fromValue: number;
                    toValue: number;
                    unitFrom: "in"
                    | "mm"
                    | "cm"
                    | "pt";
                    unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
                };
                selected?: boolean;
            }[],
        ): {
            name?: string;
            precision: | "whole"
            | "oneDp"
            | "twoDp"
            | "threeDp"
            | "fourDp"
            | "1/2"
            | "1/4"
            | "1/8"
            | "1/16";
            scale: {
                fromValue: number;
                toValue: number;
                unitFrom: "in"
                | "mm"
                | "cm"
                | "pt";
                unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
            };
            selected?: boolean;
        }[]
      • Parameters

        • configuration: {
              name?: string;
              precision:
                  | "whole"
                  | "oneDp"
                  | "twoDp"
                  | "threeDp"
                  | "fourDp"
                  | "1/2"
                  | "1/4"
                  | "1/8"
                  | "1/16";
              scale: {
                  fromValue: number;
                  toValue: number;
                  unitFrom: "in"
                  | "mm"
                  | "cm"
                  | "pt";
                  unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
              };
              selected?: boolean;
          }[]
          • Optionalname?: string

            Your custom configuration name. It has to be unique.

          • precision:
                | "whole"
                | "oneDp"
                | "twoDp"
                | "threeDp"
                | "fourDp"
                | "1/2"
                | "1/4"
                | "1/8"
                | "1/16"

            Precision values for the length of measurement annotations

          • scale: {
                fromValue: number;
                toValue: number;
                unitFrom: "in" | "mm" | "cm" | "pt";
                unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
            }

            The custom scale passed in the configuration, it represent the scale used in the document

          • Optionalselected?: boolean

            Whether a custom scale is selected or not.

        Returns {
            name?: string;
            precision:
                | "whole"
                | "oneDp"
                | "twoDp"
                | "threeDp"
                | "fourDp"
                | "1/2"
                | "1/4"
                | "1/8"
                | "1/16";
            scale: {
                fromValue: number;
                toValue: number;
                unitFrom: "in"
                | "mm"
                | "cm"
                | "pt";
                unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
            };
            selected?: boolean;
        }[]

        • Optionalname?: string

          Your custom configuration name. It has to be unique.

        • precision:
              | "whole"
              | "oneDp"
              | "twoDp"
              | "threeDp"
              | "fourDp"
              | "1/2"
              | "1/4"
              | "1/8"
              | "1/16"

          Precision values for the length of measurement annotations

        • scale: {
              fromValue: number;
              toValue: number;
              unitFrom: "in" | "mm" | "cm" | "pt";
              unitTo: "in" | "mm" | "cm" | "pt" | "ft" | "m" | "yd" | "km" | "mi";
          }

          The custom scale passed in the configuration, it represent the scale used in the document

        • Optionalselected?: boolean

          Whether a custom scale is selected or not.

    Configure a custom scale and pass it to our viewer.


    const customScales = [
    {
    scale: {
    unitFrom: NutrientViewer.MeasurementScaleUnitFrom.CENTIMETERS,
    unitTo: NutrientViewer.MeasurementScaleUnitTo.METERS,
    fromValue: 1,
    toValue: 2
    },
    precision: NutrientViewer.MeasurementPrecision.FOUR,
    selected: true
    }
    ];

    NutrientViewer.load({
    // Other options.
    measurementValueConfiguration: (documentScales) => {
    return [...customScales, ...documentScales];
    }
    });