The MeasurementCreationService class provides methods to configure and control the measurement creation process in the PDF viewer. This service allows you to customize measurement behavior, including enabling/disabling markup, setting labels, controlling result panel visibility, and configuring snap modes.
More...
|
| | setLabel (label:string) |
| | Sets the label (caption) text for measurement annotations. This should be called before creating measurement annotations, as the configured label will be applied to newly created measurements. More...
|
| |
| | setMarkupEnabled (enabled:boolean) |
| | Sets whether markup is enabled for measurement creation. When disabled, the measurement creation tool will only add measurement marks on the page without creating measurement annotations. This should be called before creating measurement annotations, as the configured value will be applied to newly created measurements. More...
|
| |
| | setScaleRatio (scaleRatioOptions:{ userSpaceScaleValue:number;userSpaceUnit:keyof typeof Annot_Unit_Type;realScaleValue:number;realUnit:keyof typeof Annot_Unit_Type;}) |
| | Sets the scale ratio for measurement annotations, defining the mapping between document space and real-world measurements. This should be called before creating measurement annotations, as the configured scale ratio will be applied to newly created measurements. More...
|
| |
| | setShowResultInfomation (enabled:boolean) |
| | Sets whether to show the measurement result information panel. When enabled, the measurement result panel will be displayed to show real-time measurement data such as distance, angle, area, etc. More...
|
| |
| | setSnapModes (snapModes:SNAP_MODE[]=[]) |
| | Sets the snap modes for measurement creation. Snap modes included in the array will be enabled; if the array is empty, all snap modes will be disabled. More...
|
| |
| | addDestroyHook (...hooks) |
| | Add a function to destroyHooks list, which will be called during destroy. More...
|
| |
| | destroy () |
| |
| | ownsTo (owner) |
| | Establishes an ownership relationship where this instance will be destroyed when the owner is destroyed. Additionally, the owner will be automatically removed from the destroyHooks list when this instance is destroyed. More...
|
| |
The MeasurementCreationService class provides methods to configure and control the measurement creation process in the PDF viewer. This service allows you to customize measurement behavior, including enabling/disabling markup, setting labels, controlling result panel visibility, and configuring snap modes.
- See also
- PDFViewer.getCreateMeasurementService
- Since
- 11.1.0 Example:
function example(pdfViewer) {
const service = pdfViewer.getCreateMeasurementService();
service.setMarkupEnabled(false);
}
◆ setLabel()
| CreateMeasurementService::setLabel |
( |
|
label:string | ) |
|
|
inline |
Sets the label (caption) text for measurement annotations. This should be called before creating measurement annotations, as the configured label will be applied to newly created measurements.
- Parameters
-
| label | string - The label text to display on the measurement annotation. |
- Returns
- Promise<void>
- Since
- 11.1.0 Example:
function example(pdfViewer) {
const service = pdfViewer.getCreateMeasurementService();
service.setLabel('Wall Length');
}
◆ setMarkupEnabled()
| CreateMeasurementService::setMarkupEnabled |
( |
|
enabled:boolean | ) |
|
|
inline |
Sets whether markup is enabled for measurement creation. When disabled, the measurement creation tool will only add measurement marks on the page without creating measurement annotations. This should be called before creating measurement annotations, as the configured value will be applied to newly created measurements.
- Parameters
-
| enabled | boolean - Whether to enable markup. If true, measurement annotations will be created; if false, only page marks will be added. |
- Returns
- Promise<void>
- Since
- 11.1.0 Example:
function example(pdfViewer) {
const service = pdfViewer.getCreateMeasurementService();
service.setMarkupEnabled(false);
}
◆ setScaleRatio()
| CreateMeasurementService::setScaleRatio |
( |
|
scaleRatioOptions:{ userSpaceScaleValue:number;userSpaceUnit:keyof typeof Annot_Unit_Type;realScaleValue:number;realUnit:keyof typeof Annot_Unit_Type;} | ) |
|
|
inline |
Sets the scale ratio for measurement annotations, defining the mapping between document space and real-world measurements. This should be called before creating measurement annotations, as the configured scale ratio will be applied to newly created measurements.
- Parameters
-
| scaleRatioOptions | object - The scale ratio configuration object. |
| scaleRatioOptions.userSpaceScaleValue | number - The numeric scale value in document (user) space. |
| scaleRatioOptions.userSpaceUnit | Annot_Unit_Type - The unit type for the document space measurement. |
- See also
- PDF.annots.constant.Annot_Unit_Type
- Parameters
-
| scaleRatioOptions.realScaleValue | number - The numeric scale value in real-world measurement. |
| scaleRatioOptions.realUnit | Annot_Unit_Type - The unit type for the real-world measurement. |
- See also
- PDF.annots.constant.Annot_Unit_Type
- Returns
- Promise<void>
- Since
- 11.1.0 Example:
function example(pdfViewer) {
const service = pdfViewer.getCreateMeasurementService();
service.setScaleRatio({
userSpaceScaleValue: 1,
userSpaceUnit: PDF.annots.constant.Annot_Unit_Type.cm,
realScaleValue: 1,
realUnit: PDF.annots.constant.Annot_Unit_Type.ft
});
}
◆ setShowResultInfomation()
| CreateMeasurementService::setShowResultInfomation |
( |
|
enabled:boolean | ) |
|
|
inline |
Sets whether to show the measurement result information panel. When enabled, the measurement result panel will be displayed to show real-time measurement data such as distance, angle, area, etc.
- Parameters
-
| enabled | boolean - Whether to show the measurement result information panel. |
- Returns
- Promise<void>
- Since
- 11.1.0 Example:
function example(pdfViewer) {
const service = pdfViewer.getCreateMeasurementService();
service.setShowResultInfomation(true);
}
◆ setSnapModes()
| CreateMeasurementService::setSnapModes |
( |
|
snapModes:SNAP_MODE[] = [] | ) |
|
|
inline |
Sets the snap modes for measurement creation. Snap modes included in the array will be enabled; if the array is empty, all snap modes will be disabled.
- See also
- PDFViewer.setSnapMode
-
PDFViewer.getSnapMode
- Parameters
-
| snapModes | SNAP_MODE[] - An array of snap modes to enable. Available modes: SNAP_MODE.EndPoint, SNAP_MODE.MidPoint, SNAP_MODE.IntersectionPoint, SNAP_MODE.NearestPoint. Defaults to an empty array (all snap modes disabled). |
- Returns
- void
- See also
- PDFViewer.setSnapMode
-
PDFViewer.getSnapMode
- Since
- 11.1.0 Example:
function example(pdfViewer) {
const service = pdfViewer.getCreateMeasurementService();
service.setSnapModes([
PDFViewCtrl.constants.SNAP_MODE.EndPoint,
PDFViewCtrl.constants.SNAP_MODE.IntersectionPoint
]);
}