Some test text!

Search
Hamburger Icon

iOS / Guides / Create

Customizing PDF measurement tool on iOS

Overview

PDF documents allow line, polyline and polygon annotations to contain measurement information to measure the distance, perimeter, and area of parts of a document. A scale can be defined so that for example, one inch on the document is equivalent to one foot, allowing you determine the actual size of things in an architectural diagram once you know the scale.

The Apryse iOS SDK has built-in tools allowing you to create these annotations and provides a UI to modify the scale and precision of these measurements.

Measurement tools

There are three measurement tools:

  • PTRulerCreate for measuring straight line distances
  • PTPerimeterCreate for measuring perimeters by drawing a polyline shape
  • PTAreaCreate for measuring the area enclosed by a polygon

Each of these have a scale ratio and precision which can be changed using the UI. The scale defines the translation from document space to world space as described in the Overview section above. The precision defines the number of significant digits to which the measurement information is saved to the annotation and in the case of ruler annotations, displayed to the user in the form of a caption.

Ruler annotation

To create a measurement annotation, tap and hold on an area of the PDF without any text or annotations to bring up the long-press menu. Then scroll through the menu to find the "Measure..." option. Clicking that option will reveal the Ruler, Perimeter, and Area tools.

Tools menu

Point snapping

Snapping is useful when you want to precisely place annotations in documents by snapping them to lines & objects. The point snapping API can be used to easily place annotations to the exact location.

Point snapping
Measurement tool snapping.

This is disabled by default but can be enabled for measurement tools as follows:

// Enable end-point snapping for measurement tools
self.toolManager.isSnapToDocumentGeometryEnabled = true

There is also a UI toggle to enable and disable snapping for all measurement tools. This is displayed in the style picker for measurement tools and annotations.

Measurement tool snapping toggle

Calibration

The Calibrate menu option for measurement annotations allows you to specify a PDF's scale, enabling accurate measurements.

measurement calibration

Get the answers you need: Chat with us