Measure distance and area in a PDF using JavaScript
Nutrient Web SDK enables users to measure distance and area in a PDF. You can use a known page-to-real-world scale or calibrate a scale from a drawn length. For an overview of measurement capabilities across all platforms, refer to the PDF measurement tools SDK page.
What is a PDF measuring tool?
A PDF measuring tool measures distances, lengths, and areas inside a PDF document. Teams in architecture, engineering, design, and construction use these tools to measure drawings without printing them.
PDF measuring tools reduce manual calculations and help users work from the PDF file itself. This matters when a workflow depends on precise dimensions from plans, diagrams, or technical drawings.
Key capabilities of PDF measurement tools
Nutrient Web SDK supports these measurement capabilities:
- Measure distance — Measure the distance between two or more points on a PDF page.
- Measure area — Measure the area inside a custom-drawn polygon, rectangle, or ellipse.
- Calibrate scale — Calibrate the scale of a page using a known distance.
- Show compound units — Display a distance as smaller units, such as
6 ft 3 in.
Customize measurement lines by configuring their appearance, saving multiple settings, and switching between settings for different measurement needs.
How to use a PDF measuring tool with Nutrient Web SDK
To use a PDF measuring tool in Nutrient Web SDK, load your PDF document into the viewer. Then open the measurement tools from the toolbar.
Available measurement tools
Nutrient Web SDK provides these measurement tools:
- Distance tool — Measures the distance between two points.
- Perimeter tool — Measures the total length around connected points.
- Polygon area tool — Measures the area of a custom-drawn polygon.
- Ellipse area tool — Measures the area of an ellipse.
- Rectangle area tool — Measures the area of a rectangle.
Configure the scale and precision for each measurement workflow.
Guides for measurements
Use these guides to add and configure measurements:
- Measure distance — Measure straight lines or connected lines with code or the built-in UI.
- Measure area — Measure the surface of an area with code or the built-in UI.
- Configure measurements — Configure measurement scale and precision with code or the built-in UI.
Common use cases for PDF measuring tools
PDF measuring tools support workflows that depend on dimensions from PDF drawings and documents:
- Architecture and engineering — Measure distances and lengths in drawings.
- Construction and design — Calculate areas and perimeters in project plans.
- Research and development — Analyze PDF drawings and technical documents.
- Form and template creation — Create and edit PDF forms and templates.
- File conversion — Convert PDF files to formats such as CAD or image files.
Try measurement tools
Test measurement tools in the online demo. Upload your own PDF and measure distance or area in the document.
FAQs
Yes. Nutrient Web SDK enables you to measure distance and area in a PDF with code.
Yes. Calibrate measurement tools using a known distance in the PDF.
Yes. Configure properties such as stroke color, line caps, and measurement precision for all measurement types.
Yes. Nutrient Web SDK saves scale and precision settings in the document, and the settings persist across devices.
Deleting a scale automatically removes all measurements associated with that scale.
Yes. Attach a chain of smaller units to a scale so distance and perimeter measurements read 6 ft 3 in instead of 6.25 ft. Refer to the compound mixed-unit measurements section for more information.