Some test text!


Customizing PDF measurement tool in Xamarin

This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here.


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 PDFTron 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.

linkMeasurement tools

There are three measurement tools:

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 Ruler, Perimeter, and Area tools.

Tools menu

linkPoint 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
mToolManager.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


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: Support


Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.