Configure PDF Measurements in MAUI

To measure distance and area in your MAUI app, contact the Sales team to add the Measurement Tools component to your license, or run the SDK in trial mode.

Enabling Measurement Tools

By default, measurement tools aren’t visible in the main toolbar if your license includes the Measurement Tools component.

To enable measurement tools, add them to the main toolbar as follows:

PSPDFKitController.MainToolbar.ToolbarItems.Add(
    new MainToolbarItems.MeasureToggleButton());

Configuring Scale and Precision

The scale determines the size of an object on a page relative to the size of a corresponding real-world object. For example, a document shows the floor plan of a house where one centimeter on the floor plan represents two meters in the house.

The precision determines the decimal places or fractions displayed in the measured value.

To configure scale and precision using the built-in UI, choose one of the following options:

  • Specify how length on a page corresponds to length in the real world.

  • Specify the real-world length corresponding to a line you draw on the page.

To configure a scale by specifying how length on a page corresponds to length in the real world, follow these steps:

  1. Click the measurement tools icon in the toolbar.

  2. If this is the first time configuring a scale, click Set Scale. If you already created a scale and want to create a new scale, click the scales dropdown on the right, and then click Edit or add new scale.

  3. Click Add new scale.

  4. Rename the scale.

  5. Specify how length on a page corresponds to length in the real world.

  6. In Precision, specify the decimal places or fractions to display. You can display a maximum of four decimal places or fractions up to one sixteenth.

  7. Click Done.

When you delete a scale, all measurements associated with that scale are automatically deleted.

To configure a scale by specifying the real-world length corresponding to a line you draw on the page, follow these steps:

  1. Click the measurement tools icon in the toolbar.

  2. Click the scales dropdown on the right, and then click either Use calibration tool or the calibration icon.

  3. Draw a line on the page.

  4. In Calibrate length, specify the real-world length corresponding to the line you drew.

  5. Rename the scale.

  6. In Precision, specify the decimal places or fractions to display. You can display a maximum of four decimal places or fractions up to one sixteenth.

  7. Click Done.

The example below creates a new scale so that one centimeter in a floor plan document represents two meters in a house.

The example below calibrates a new scale so that the length of the distance measurement represents 24 meters in the real world.

The example below configures precision so that four decimal places are displayed for a scale.

Note that setting the precision only affects the visible value label.

Selecting the Scale for a Measurement

You can set the scale you want to use for each measurement. To set the scale for a measurement, follow these steps:

  1. Click a measurement.

  2. In the toolbar, click the scales dropdown.

  3. Select the scale you want to use for the measurement.

Displaying a Secondary Unit of Measurement

The measurement value can be displayed in a secondary unit of measurement. This is displayed in parentheses after the primary unit of measurement.

To display the measurement value in a secondary unit of measurement, follow these steps:

  1. Click the measurement tools icon in the toolbar.

  2. Click the scales dropdown on the right, and then click Edit or add new scale.

  3. Enable Display Secondary Unit.

  4. Select the unit of measurement and the precision used to display the secondary unit of measurement.

  5. Click Done.