---
title: "Measure distance in a PDF using JavaScript | Nutrient Web SDK"
canonical_url: "https://www.nutrient.io/guides/web/measurements/measure-distance/"
md_url: "https://www.nutrient.io/guides/web/measurements/measure-distance.md"
last_updated: "2026-05-30T02:20:01.405Z"
description: "Learn how to measure distance in a PDF using JavaScript with Nutrient Web SDK. Measure between two points or multiple connected points programmatically or through the built-in user interface (UI)."
---

# Measure distance in a PDF using JavaScript

Measure distance in a PDF using Nutrient Web SDK starting with version 2022.5. To measure distance in your app, [contact the Sales team](https://www.nutrient.io/contact-sales) to add the Measurement Tools component to your license, or run the SDK in trial mode.

Measure distance in one of the following ways:

- [Measure the distance between two points](#measuring-distance-between-two-points)

- [Measure the distance between multiple connected points](#measuring-distance-between-multiple-connected-points)

## Measuring distance between two points

Measure the distance between two points in one of the following ways:

- [Using the built-in user interface (UI)](#measuring-distance-between-two-points-using-the-built-in-ui)

- [Programmatically](#measuring-distance-between-two-points-programmatically)

### Measuring distance between two points using the built-in UI

To measure the distance between two points using the built-in UI, follow the steps below:

1. Click the measurement tools icon in the toolbar.

2. Tap **Distance**.

3. Draw a straight line between the two points you want to measure.

### Measuring distance between two points programmatically

To measure the distance between two points programmatically, use the [`LineAnnotation` shape constructor](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.LineAnnotation.html), which takes a [`measurementScale` property](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.ShapeAnnotation.html#measurementscale) and a [`measurementPrecision` property](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.ShapeAnnotation.html#measurementprecision) as its parameters, as demonstrated in the code snippet below:

```js

let pspdfkitInstance; // Global or module-level variable.
NutrientViewer.load({...baseOptions,
  toolbarItems: [...NutrientViewer.defaultToolbarItems,
    { type: "cloudy-rectangle", dropdownGroup: "shapes" },
    { type: "dashed-rectangle", dropdownGroup: "shapes" },
    { type: "cloudy-ellipse", dropdownGroup: "shapes" },
    { type: "dashed-ellipse", dropdownGroup: "shapes" },
    { type: "dashed-polygon", dropdownGroup: "shapes" },
    { type: "content-editor", dropdownGroup: "editor" },
    { type: "form-creator", dropdownGroup: "editor" },
    { type: "measure", dropdownGroup: "editor" },
    { type: "document-comparison", dropdownGroup: "editor" },
  ],
  measurementValueConfiguration: (documentScales) => {
    const customScale = {
      name: "myCustomScale",
      scale: {
        unitFrom: NutrientViewer.MeasurementScaleUnitFrom.POINTS, // Using the enum value.
        unitTo: NutrientViewer.MeasurementScaleUnitTo.CENTIMETERS, // Using the enum value.
        fromValue: 1,
        toValue: 0.05, // 1 pt = 0.05 cm
      },
      precision: NutrientViewer.MeasurementPrecision.TWO, // Using the enum value
      selected: true, // Make this the default scale.
    };
    return [customScale,...documentScales];
  },
}).then(async (instance) => {
    try {
      // Create measurement annotation.
      const lineAnnotation = new NutrientViewer.Annotations.LineAnnotation({
        strokeColor: NutrientViewer.Color.RED,
        pageIndex: 0,
        startPoint: new NutrientViewer.Geometry.Point({ x: 100, y: 100 }),
        endPoint: new NutrientViewer.Geometry.Point({ x: 300, y: 300 }),
        boundingBox: new NutrientViewer.Geometry.Rect({
          left: 100,
          top: 100,
          width: 200,
          height: 200,
        }),
        measurementPrecision: "threeDp",
        measurementScale: {
          unitFrom: "in",
          unitTo: "in",
          fromValue: 1,
          toValue: 1,
        },
        lineCaps: { start: "butt", end: "butt" },
      });

      // Add the annotation to the document.
      await instance.create(lineAnnotation);
      console.log("Measurement annotation created and added to the document.");

      console.log((await instance.getAnnotations(0)).toJS());
    } catch (error) {
      console.error("Error creating or adding annotation:", error);
    }
  }).catch(function (error) {
    console.error("Error loading PDF:", error.message);
  });

```

You can try the code snippet above in our [playground](https://www.nutrient.io/demo/sandbox?p=eyJqcyI6ImxldCBwc3BkZmtpdEluc3RhbmNlOyAvLyBHbG9iYWwgb3IgbW9kdWxlLWxldmVsIHZhcmlhYmxlXG5QU1BERktpdC5sb2FkKHtcbiAgLi4uYmFzZU9wdGlvbnMsXG4gIHRvb2xiYXJJdGVtczogW1xuICAgIC4uLlBTUERGS2l0LmR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1ZSwiY3VzdG9tRm9udEZpbGVOYW1lcyI6W119LCJ2IjoxfQ%3D%3D). For more information on scale and precision, refer to the [guide on configuring measurements](https://www.nutrient.io/guides/web/measurements/configure-measurements.md).

## Measuring distance between multiple connected points

Measure the distance between multiple connected points in one of the following ways:

- [Using the built-in user interface (UI)](#measuring-distance-between-multiple-connected-points-using-the-built-in-ui)

- [Programmatically](#measuring-distance-between-multiple-connected-points-programmatically)

### Measuring distance between multiple connected points using the built-in UI

To measure the distance between multiple connected points using the built-in UI, follow the steps below:

1. Click the measurement tools icon in the toolbar.

2. Tap **Perimeter**.

3. Draw lines between the multiple points you want to measure.

### Measuring distance between multiple connected points programmatically

To measure the distance between multiple connected points programmatically, use the [`PolylineAnnotation` shape constructor](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.PolylineAnnotation.html), which takes a [`measurementScale` property](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.ShapeAnnotation.html#measurementscale) and a [`measurementPrecision` property](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.ShapeAnnotation.html#measurementprecision) as its parameters, as demonstrated in the code snippet below:

```js

let pspdfkitInstance; // Global or module-level variable.
NutrientViewer.load({...baseOptions,
  theme: NutrientViewer.Theme.DARK,
  toolbarItems: [...NutrientViewer.defaultToolbarItems,
    { type: "cloudy-rectangle", dropdownGroup: "shapes" },
    { type: "dashed-rectangle", dropdownGroup: "shapes" },
    { type: "cloudy-ellipse", dropdownGroup: "shapes" },
    { type: "dashed-ellipse", dropdownGroup: "shapes" },
    { type: "dashed-polygon", dropdownGroup: "shapes" },
    { type: "content-editor", dropdownGroup: "editor" },
    { type: "form-creator", dropdownGroup: "editor" },
    { type: "measure", dropdownGroup: "editor" },
    { type: "document-comparison", dropdownGroup: "editor" },
  ],
  measurementValueConfiguration: (documentScales) => {
    const customDistanceScale = {
      name: "myCustomDistanceScale",
      scale: {
        unitFrom: "pt", // Simple string for points.
        unitTo: "cm",   // Simple string for centimeters.
        fromValue: 1,
        toValue: 0.05,
      },
      precision: "2", // Simple string for precision.
      selected: true,
    };
    return [customDistanceScale,...documentScales];
  },
}).then(async (instance) => {
    console.log("Nutrient loaded!");
    try {
      // Define the points for the polyline (forming a zigzag).
      const points = NutrientViewer.Immutable.List([
        new NutrientViewer.Geometry.Point({ x: 100, y: 100 }),
        new NutrientViewer.Geometry.Point({ x: 200, y: 150 }),
        new NutrientViewer.Geometry.Point({ x: 150, y: 200 }),
        new NutrientViewer.Geometry.Point({ x: 250, y: 250 }),
      ]);

      // Calculate the bounding box (approximate).
      const minX = 100;
      const minY = 100;
      const maxX = 250;
      const maxY = 250;
      const boundingBox = new NutrientViewer.Geometry.Rect({
        left: minX,
        top: minY,
        width: maxX - minX,
        height: maxY - minY,
      });

      // Create the polyline annotation for distance measurement.
      const polylineAnnotation = new NutrientViewer.Annotations.PolylineAnnotation({
        strokeColor: NutrientViewer.Color.GREEN,
        pageIndex: 0,
        points: points,
        strokeWidth: 3,
        boundingBox: boundingBox,
        measurementPrecision: "twoDp", // Using string format.
        measurementScale: {
          unitFrom: "pt", // Simple string for points.
          unitTo: "cm",   // Simple string for centimeters.
          fromValue: 1,
          toValue: 0.05, // Linear conversion.
        },
        isMeasurement: true, // Mark it as a measurement.
      });

      // Add the annotation to the document.
      await instance.create(polylineAnnotation);
      console.log("Polyline distance measurement annotation created and added.");
      console.log((await instance.getAnnotations(0)).toJS());
    } catch (error) {
      console.error("Error creating or adding polyline measurement annotation:", error);
    }
  }).catch(function (error) {
    console.error("Error loading PDF:", error.message);
  });

```

You can try the code above snippet in our [playground](https://www.nutrient.io/demo/sandbox?p=eyJ2IjoxLCJjc3MiOiIvKiBBZGQgeW91ciBDU1MgaGVyZSAqL1xuXHQiLCJzZXR0aW5ncyI6eyJmaWxlTmFtZSI6ImJhc2ljLnBkZiJ9LCJqcyI6ImxldCBwc3BkZmtpdEluc3RhbmNlOyAvLyBHbG9iYWwgb3IgbW9kdWxlLWxldmVsIHZhcmlhYmxlXG5QU1BER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vLyBMaW5lYXIgY29udmVyc2lvblxuICAgICAgICB9LFxuICAgICAgICBpc01lYXN1cmVtZW50OiB0cnVlLCAvLyBFeHBsaWNpdGx5IG1hcmsgaXQgYXMgYSBtZWFzdXJlbWVudFxuICAgICAgfSk7XG5cbiAgICAgIC8vIEFkZCB0aGUgYW5ub3RhdGlvbiB0byB0aGUgZG9jdW1lbnRcbiAgICAgIGF3YWl0IGluc3RhbmNlLmNyZWF0ZShwb2x5bGluZUFubm90YXRpb24pO1xuICAgICAgY29uc29sZS5sb2coXCJQb2x5bGluZSBkaXN0YW5jZSBtZWFzdXJlbWVudCBhbm5vdGF0aW9uIGNyZWF0ZWQgYW5kIGFkZGVkLlwiKTtcbiAgICAgIGNvbnNvbGUubG9nKChhd2FpdCBpbnN0YW5jZS5nZXRBbm5vdGF0aW9ucygwKSkudG9KUygpKTtcbiAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgY29uc29sZS5lcnJvcihcIkVycm9yIGNyZWF0aW5nIG9yIGFkZGluZyBwb2x5bGluZSBtZWFzdXJlbWVudCBhbm5vdGF0aW9uOlwiLCBlcnJvcik7XG4gICAgfVxuICB9KVxuICAuY2F0Y2goZnVuY3Rpb24gKGVycm9yKSB7XG4gICAgY29uc29sZS5lcnJvcihcIkVycm9yIGxvYWRpbmcgUERGOlwiLCBlcnJvci5tZXNzYWdlKTtcbiAgfSk7In0%253D). For more information on scale and precision, refer to the [guide on configuring measurements](https://www.nutrient.io/guides/web/measurements/configure-measurements.md).

## Configuring measurements

For more information on configuring measurements, refer to the [guide on configuring measurements](https://www.nutrient.io/guides/web/measurements/configure-measurements.md).
---

## Related pages

- [Measure distance and area in a PDF using JavaScript](/guides/web/measurements.md)
- [Configure measurements in a PDF using JavaScript](/guides/web/measurements/configure-measurements.md)
- [Measure area in a PDF using JavaScript](/guides/web/measurements/measure-area.md)

