Some test text!
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.
There are three measurement tools:
PTRulerCreatefor measuring straight line distances
PTPerimeterCreatefor measuring perimeters by drawing a polyline shape
PTAreaCreatefor 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.
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.
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.
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.
The Calibrate menu option for measurement annotations allows you to specify a PDF's scale, enabling accurate measurements.
Get the answers you need: Support
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.
Join our live demo to learn about use cases & capabilities for WebViewerLearn more