Measure Area in a PDF Using JavaScript
Measure area in a PDF using PSPDFKit for Web starting with version 2022.5. To measure area in your app, contact the Sales team to add the Measurement Tools component to your license, or run the SDK in trial mode.
Measure area in one of the following ways:
Measuring the Area of a Polygon
Measure the area of a custom-drawn polygon in one of the following ways:
Measuring the Area of a Polygon Using the Built-In UI
To measure the area of a polygon using the built-in UI, follow these steps:
-
Click the measurement tools icon.
-
Tap Polygon Area.
-
Draw a polygon around the area you want to measure.
Measuring the Area of a Polygon Programmatically
To measure the area of a polygon programmatically, use the PolygonAnnotation
shape constructor, which takes a measurementScale
property and a measurementPrecision
property as its parameters. For more information on scale and precision, see the guide on configuring measurements.
Measuring the Area of an Ellipse
Measure the area of an ellipse in one of the following ways:
Measuring the Area of an Ellipse Using the Built-In UI
To measure the area of an ellipse using the built-in UI, follow these steps:
-
Click the measurement tools icon.
-
Tap Ellipse Area.
-
Draw an ellipse around the area you want to measure.
Measuring the Area of an Ellipse Programmatically
To measure the area of an ellipse programmatically, use the CircleAnnotation
shape constructor, which takes a measurementScale
property and a measurementPrecision
property as its parameters. For more information on scale and precision, see the guide on configuring measurements.
Measuring the Area of a Rectangle
Measure the area of a rectangle in one of the following ways:
Measuring the Area of a Rectangle Using the Built-In UI
To measure the area of a rectangle using the built-in UI, follow these steps:
-
Click the measurement tools icon.
-
Tap Rectangle Area.
-
Draw a rectangle around the area you want to measure.
Measuring the Area of a Rectangle Programmatically
To measure the area of a rectangle programmatically, use the SquareAnnotation
shape constructor, which takes a measurementPrecision
property and a measurementPrecision
property as its parameters. For more information on scale and precision, see the guide on configuring measurements.
Configuring Measurements
For more information on configuring measurements, see the guide on configuring measurements.