The document viewer creates its measurement manager; use documentViewer.getMeasurementManager() instead of calling this.
The document viewer whose measurement items are managed.
Adds a listener for an event. Adding the same function twice for one event has no effect.
Applies a scale to measurement annotations and tools, and triggers scaleUpdated.
When no scale exists yet, the scale is applied to every measurement tool and applyTo is ignored.
When items already use the same scale, the scale takes their precision.
The annotations and tools to apply it to. Items without measurement data are skipped.
The scale to apply.
Deletes a scale and triggers scaleUpdated.
Annotations using the scale are deleted; tools using it switch to the first remaining scale.
The last remaining scale cannot be deleted: a warning is logged and nothing changes.
The scale to delete.
Stops setStyles on a measurement tool from restyling existing annotations.
Makes setStyles on a measurement tool also restyle the annotations that use the same scale. Off by default.
Gets the scales that will no longer be used after createAndApplyScale is called with the same options. Call it first to tell the user which scales are about to disappear.
The options you will pass to createAndApplyScale.
The annotations and tools to apply it to.
The scale to apply.
The scale strings that no item will use any more.
Gets the precision used by the items that use a scale.
The scale to look up.
The precision, such as 0.01, or undefined when no item uses the scale.
Gets every scale in use and the measurement items that use it. Measurement tools that have no scale yet are given the first scale.
An object whose keys are scale strings (such as 1 in = 1 ft) and whose values are the annotations and tools using that scale.
Tells whether style syncing between measurement tools and annotations is on.
true after enableAnnotationAndToolStyleSyncing, otherwise false.
Removes every listener of every event.
Replaces a scale with another one on every annotation and tool that uses it, and triggers scaleUpdated.
Turns a distance measurement around its start point to the given angle, keeping its length; the end point is kept inside the page. ComPDFKit extension.
A distance measurement line.
The angle from the positive x axis, counter-clockwise as seen on the page.
Sets the measured length of a distance measurement, in the world unit of its scale.
The left end of the line stays where it is and the other end moves along the line; the result is kept inside the page.
The change is committed like annotationManager.updateAnnotation.
ComPDFKit extension.
A distance measurement line.
The new length in the world unit of the annotation's scale (for 1 in = 1 ft, in feet).
Sets the measured width (horizontal side) and / or height (vertical side) of a rectangular area measurement, in the world unit of its scale. The top-left corner stays where it is; the result is kept inside the page. Polygons that are not axis-aligned rectangles are left unchanged. ComPDFKit extension.
A rectangular area measurement (a polygon whose vertices are the corners of an axis-aligned rectangle).
The new size in the world unit of the annotation's scale.
Optionalheight?: numberThe new vertical side; omit to keep it.
Optionalwidth?: numberThe new horizontal side; omit to keep it.
Static ReadonlyEventsNames of the events this class triggers.
ReadonlyCREATE_ANNOTATION_WITH_NO_SCALE: "createAnnotationWithNoScale"'createAnnotationWithNoScale': fired when a measurement tool cannot create an annotation because no scale is set.
ReadonlySCALE_UPDATED: "scaleUpdated"'scaleUpdated': fired when scales are created, changed or deleted.
Manages the scales of measurement annotations and measurement tools.
Measurement items are grouped by their scale string (such as
1 in = 1 ft). Applying a scale to an annotation re-measures it; applying a scale to a tool affects the annotations it creates afterwards. The calibration tool and the annotations it draws are not measurement items.Get the instance with
documentViewer.getMeasurementManager().Example