> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/measurement/measurement-tools.md).

# Customize the Scale of the PDF Measurement Tool

Customize the scale of your PDF measurement tool easily with this comprehensive guide. Learn how to adjust scale ratio and precision either through the user interface or programmatically. Choose from

Each of the measurement tools and measurement annotations has a scale ratio and precision. These properties can be changed using the UI or programmatically.

## Setting scale and precision with the UI

To set the measurement properties, select a tool or an annotation, the current scale will show in the overlay.

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-a771c7de01ce005272b0b9075ac08d6e80375ac9%2F6e8f7a99dc4ad155dc79e4e4a984137f8a1da0ca-568x498.png?alt=media)

Click it will open the dropdown menu showing all the existing scales. The current scale is highlighted with blue color.

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-c378f775c7ec108ad9bf694c6fbf2d60a915197d%2F0e7a7a8898400a4585705050277ea6ce498f9a64-550x492.png?alt=media)

Click another scale, or click the Add New Scale button to create a new scale, and then it will be applied to the current tool or annotation.

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-363052e2617492b36d98c0da3597cabd9469aee6%2F643e9bdc1891a828bdfd21e1cefbbc5c73b77e3d-1020x712.png?alt=media)

In the Scale Modal above, click the Calibrate button to calibrate the scale and apply.

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-78175d3945a38262114bcb7c85ca9c53bc5a8b21%2F1cb8441ee63a5b55a23c426a7d3a00719a18823c-1446x488.png?alt=media)

## Setting scale and precision programmatically

You can take the same approach as shown in the [Customizing tools](/web/annotation/customizing-tools.md) guide to set measurement properties. Measurement related tool names include: `AnnotationCreateDistanceMeasurement`, `AnnotationCreatePerimeterMeasurement` and `AnnotationCreateAreaMeasurement`, etc.. You can view the list of [valid tool names](/web/annotation/annotations-and-tools.md#list-of-tool-names). The following example sets the scale and precision of the distance measurement tool:

{% tabs %}
{% tab title="JavaScript (SDK v8.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    const { documentViewer } = instance.Core;
    const distanceMeasurementTool = documentViewer.getTool('AnnotationCreateDistanceMeasurement');

    distanceMeasurementTool.setStyles({
      // value of Scale is an array that is consisted of two arrays
      // the first element in each array is the scale ratio and the second element is the unit.
      // valid units are: mm, cm, m, km, mi, yd, ft, in and pt
      // the following array means that for the annotations created by the distance measurement tool, 0.25 inches on the document is equal to 1 inch in the real world
      Scale: [[0.25, 'in'], [1, 'in']],

      // value of Precision is a number that means how many decimal places the calculated value should have
      Precision: 0.001
    });
  });
```

{% endcode %}

[WebViewerInstance](https://sdk.apryse.com/api/web/WebViewerInstance.html) [DocumentViewer.getTool](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#getTool__anchor) [Tool.setStyle](https://sdk.apryse.com/api/web/Core.Tools.Tool.html#setStyles__anchor)
{% endtab %}

{% tab title="JavaScript (SDK v6.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    const { docViewer } = instance;
    const distanceMeasurementTool = docViewer.getTool('AnnotationCreateDistanceMeasurement');

    distanceMeasurementTool.setStyles(() => ({
      // value of Scale is an array that is consisted of two arrays
      // the first element in each array is the scale ratio and the second element is the unit.
      // valid units are: mm, cm, m, km, mi, yd, ft, in and pt
      // the following array means that for the annotations created by the distance measurement tool, 0.25 inches on the document is equal to 1 inch in the real world
      Scale: [[0.25, 'in'], [1, 'in']],

      // value of Precision is a number that means how many decimal places the calculated value should have
      Precision: 0.001
    });
  });
```

{% endcode %}

[WebViewerInstance](https://sdk.apryse.com/api/web/WebViewerInstance.html) [DocumentViewer.getTool](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#getTool__anchor) [Tool.setStyle](https://sdk.apryse.com/api/web/Core.Tools.Tool.html#setStyles__anchor)
{% endtab %}
{% endtabs %}

## Getting scale and precision programmatically

The following example logs the precision and scale of the distance measurement tool:

{% tabs %}
{% tab title="JavaScript (SDK v8.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    const { documentViewer } = instance.Core;
    const distanceMeasurementTool = documentViewer.getTool('AnnotationCreateDistanceMeasurement');

    console.log(distanceMeasurementTool.defaults.Scale);
    console.log(distanceMeasurementTool.defaults.Precision);
  });
```

{% endcode %}

[WebViewerInstance](https://sdk.apryse.com/api/web/WebViewerInstance.html) [DocumentViewer.getTool](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#getTool__anchor)
{% endtab %}

{% tab title="JavaScript (SDK v6.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    const { docViewer } = instance;
    const distanceMeasurementTool = docViewer.getTool('AnnotationCreateDistanceMeasurement');

    console.log(distanceMeasurementTool.defaults.Scale);
    console.log(distanceMeasurementTool.defaults.Precision);
  });
```

{% endcode %}

[WebViewerInstance](https://sdk.apryse.com/api/web/WebViewerInstance.html) [DocumentViewer.getTool](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#getTool__anchor)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/measurement/measurement-tools.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
